R. P. Janaka | 23 Apr 15:34

Re: Theora got extreamly slow (Makefile.am was changed)

thanks Leonardo


In my application there are two threads. One is the theora encoder the other is a bandwidth measuring program.

Both of them are working properly when they are separated. (theora is obviously working properly, bandwidth measuring component also working properly)

So this problem is occurred when both these are joined (encoder is the main thread, bandwidth measurer is the child thread)

So i think that the problem is with my makefile. Please can anyone help me to find the problem

If you want more information I can give it


thanks in advance




On Wed, Apr 23, 2008 at 5:08 PM, Leonardo de Paula Rosa Piga <lpiga <at> terra.com.br> wrote:
Janaka,

The -O2 gcc optmizations are conservative. They don't change the
behavior of  your programs, hence, there are good chances that you
have bugs in your implementation.

On Wed, Apr 23, 2008 at 7:17 AM, R. P. Janaka <rpjanaka <at> gmail.com> wrote:
> I have tried to add a plunging to the "libtheora-1.0beta2" (network
> bandwidth measuring component was added) and Got it success for some far
>
> now the problem is when it is added the encoding process get extremely slow
> (around 20 seconds delay).
>
> I think that the problem is with my modified Makefile (some flag may have
> missed).
>
> the following is my modified Makefile.am which is in the
> "libtheora-1.0beta2/lib" directory.
>
> ******************************
>  *********************************************************
>
> DEFS     = -DLINUX -DRETSIGTYPE=void -DHAVE_SIGACTION=1
> LIBS     = -lpthread
>  INCS     = -I.
>
>
> INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib
> -I$(top_srcdir)/lib/dec -I$(top_srcdir)/lib/enc
>
> EXTRA_DIST = \
>         enc/x86_32/dct_decode_mmx.c \
>          enc/x86_32/dsp_mmx.c \
>         enc/x86_32/dsp_mmxext.c \
>         enc/x86_32/recon_mmx.c \
>         enc/x86_32/fdct_mmx.c \
>         enc/x86_32/idct_mmx.c \
>         enc/x86_64/dsp_mmx.c \
>         enc/x86_64/dsp_mmxext.c \
>          enc/x86_64/recon_mmx.c \
>         enc/x86_64/fdct_mmx.c \
>         enc/x86_64/idct_mmx.c \
>         enc/x86_32_vs/dsp_mmx.c \
>         enc/x86_32_vs/fdct_mmx.c \
>         enc/x86_32_vs/recon_mmx.c \
>          enc/dct_encode.c \
>          enc/encode.c \
>         enc/encoder_toplevel.c
>
> lib_LTLIBRARIES = libtheora.la
>
> if THEORA_DISABLE_ENCODE
> encoder_sources = \
>     enc/encoder_disabled.c
>  else
>  encoder_sources = \
>     enc/dct_encode.c \
>     enc/encode.c \
>     enc/encoder_huffman.c \
>     enc/encoder_idct.c \
>     enc/encoder_toplevel.c \
>     ../net/nbs_client.c \
>      ../net/nbs_setsignal.c \
>     enc/encoder_quant.c \
>     enc/blockmap.c \
>     enc/common.c \
>     enc/dct.c \
>     enc/dct_decode.c \
>     enc/frarray.c \
>     enc/frinit.c \
>      enc/mcomp.c \
>     enc/misc_common.c \
>     enc/pb.c \
>     enc/pp.c \
>     enc/reconstruct.c \
>     enc/scan.c \
>     enc/dsp.c
>
> if CPU_x86_64
> enc_arch_dir = enc/x86_64
> encoder_arch_sources= \
>      $(enc_arch_dir)/dct_decode_mmx.c \
>     $(enc_arch_dir)/dsp_mmx.c \
>     $(enc_arch_dir)/dsp_mmxext.c \
>     $(enc_arch_dir)/recon_mmx.c \
>     $(enc_arch_dir)/idct_mmx.c \
>     $(enc_arch_dir)/fdct_mmx.c
>  else
> if CPU_x86_32
> enc_arch_dir = enc/x86_32
> encoder_arch_sources= \
>     $(enc_arch_dir)/dct_decode_mmx.c \
>     $(enc_arch_dir)/dsp_mmx.c \
>     $(enc_arch_dir)/dsp_mmxext.c \
>     $(enc_arch_dir)/recon_mmx.c \
>      $(enc_arch_dir)/idct_mmx.c \
>     $(enc_arch_dir)/fdct_mmx.c
> endif
> endif
>
> endif
>
> decoder_sources = \
>     dec/apiwrapper.c \
>     dec/decapiwrapper.c \
>     dec/decinfo.c \
>     dec/decode.c \
>      dec/dequant.c \
>     dec/fragment.c \
>     dec/huffdec.c \
>     dec/idct.c \
>     dec/info.c \
>     dec/internal.c \
>     dec/quant.c \
>     dec/state.c
>
> if CPU_x86_64
> decoder_x86_sources = \
>      dec/x86/mmxidct.c \
>     dec/x86/mmxfrag.c \
>     dec/x86/mmxstate.c \
>     dec/x86/x86state.c
> else
> if CPU_x86_32
> decoder_x86_sources = \
>     dec/x86/mmxidct.c \
>     dec/x86/mmxfrag.c \
>     dec/x86/mmxstate.c \
>      dec/x86/x86state.c
> endif
> endif
>
> libtheora_la_SOURCES = \
>   cpu.c \
>     $(decoder_x86_sources) \
>     $(decoder_sources) \
>     $(encoder_arch_sources) \
>     $(encoder_sources) \
>   Version_script
>
> noinst_HEADERS = \
>     cpu.h \
>     internal.h \
>     enc/block_inline.h \
>     enc/codec_internal.h \
>     enc/encoder_lookup.h \
>     enc/encoder_huffman.h \
>     enc/hufftables.h \
>     enc/pp.h \
>      enc/quant_lookup.h \
>     enc/toplevel_lookup.h \
>     enc/dsp.h \
>     dec/apiwrapper.h \
>     dec/dct.h \
>     dec/decint.h \
>     dec/dequant.h \
>     dec/enquant.h \
>     dec/huffdec.h \
>     dec/huffman.h \
>      dec/idct.h \
>     dec/ocintrin.h \
>     dec/quant.h \
>     dec/x86/x86int.h
>
> CFLAGS = -g -Wall $(DEFS) $(INCS)
>
>
> libtheora_la_CFLAGS = $(OGG_CFLAGS)
>  libtheora_la_LDFLAGS = -version-info
> <at> TH_LIB_CURRENT <at> : <at> TH_LIB_REVISION <at> : <at> TH_LIB_AGE <at> <at> THEORA_LDFLAGS <at>
> libtheora_la_LIBADD = $(OGG_LIBS) $(LIBS)
>
> debug:
>     $(MAKE) all CFLAGS=" <at> DEBUG <at> " LDFLAGS="-lefence"
>
> profile:
>     $(MAKE) all CFLAGS=" <at> PROFILE <at> "
>
> ***************************************************************************************
>
> the green color lines are newly added or modified by me.
>
> As a solution I used gcc optimization options also (CFLAGS = -O2 -Wall
> $(DEFS) $(INCS))
> In this case I got some problelmes with not working some threads as I
> expected.
>
> I think there is a way to chage this makefile to work properly but
> unfortunately I have not do it.
>
> please can anyone help me to find what the wrong with me.
>
> if the information provided with this mail is not enough to decide what is
> the error, please inform me what are the additional things should I
> provides.
>
>
> --
> Regards,
> R. P. Janaka
> _______________________________________________
>  theora-dev mailing list
>  theora-dev <at> xiph.org
>  http://lists.xiph.org/mailman/listinfo/theora-dev
>
>



--
Leonardo de Paula Rosa Piga
Undergraduate Computer Engineering Student
LSC - IC - UNICAMP
http://lampiao.lsc.ic.unicamp.br/~piga



--
Regards,
R. P. Janaka
_______________________________________________
theora-dev mailing list
theora-dev <at> xiph.org
http://lists.xiph.org/mailman/listinfo/theora-dev
xiphmont | 23 Apr 17:00
Favicon

Re: Theora got extreamly slow (Makefile.am was changed)

On Wed, Apr 23, 2008 at 9:34 AM, R. P. Janaka <rpjanaka <at> gmail.com> wrote:
> In my application there are two threads. One is the theora encoder the other
> is a bandwidth measuring program.
>
> Both of them are working properly when they are separated. (theora is
> obviously working properly, bandwidth measuring component also working
> properly)
>
> So this problem is occurred when both these are joined (encoder is the main
> thread, bandwidth measurer is the child thread)

This is the basic definition of a 'concurrency bug'.  Just because
they work seperately doesn't mean there aren't substantial bugs that
will pop out when two threads work together.  Why do you think this
has anything to do with the Makefile?

Turning on optimization will often make a buggy program behave
differently because it changes the relative timings between threads.

> So i think that the problem is with my makefile. Please can anyone help me
> to find the problem

I would be very surprised if the makefile has anything to do with it.
Designing concurrent programs (threads especially) is perhaps the
single hardest thing in software engineering.  Debugging even very
simple multithreaded programs can be maddening because the simple act
of turning on debugging or turning off optimization can drastically
change how a bug behaves.

I'd love to help, but it would drive me insane....

Monty
R. P. Janaka | 24 Apr 12:21

Re: Theora got extreamly slow (Makefile.am was changed)

Thanks for your advices. now I am checking the program for fixing the bug.

Once I make a modification to the Makefile.am, I got the proper functionality in expected way. But the problem is that functionality will not happened at always, it changed randomly (some times work properly, some times half work, some time one part is work etc.).

the change i did with the Makefile.am is..


AM_CFLAGS = -O2 -Wall $(DEFS) $(INCS)
instead of
CFLAGS = -O2 -Wall $(DEFS) $(INCS)


Can any one give reasons for this behavior.....? Why this random behavior, why it is working in unpredictable way...?





On Wed, Apr 23, 2008 at 8:30 PM, <xiphmont <at> xiph.org> wrote:
On Wed, Apr 23, 2008 at 9:34 AM, R. P. Janaka <rpjanaka <at> gmail.com> wrote:
> In my application there are two threads. One is the theora encoder the other
> is a bandwidth measuring program.
>
> Both of them are working properly when they are separated. (theora is
> obviously working properly, bandwidth measuring component also working
> properly)
>
> So this problem is occurred when both these are joined (encoder is the main
> thread, bandwidth measurer is the child thread)

This is the basic definition of a 'concurrency bug'.  Just because
they work seperately doesn't mean there aren't substantial bugs that
will pop out when two threads work together.  Why do you think this
has anything to do with the Makefile?

Turning on optimization will often make a buggy program behave
differently because it changes the relative timings between threads.

> So i think that the problem is with my makefile. Please can anyone help me
> to find the problem

I would be very surprised if the makefile has anything to do with it.
Designing concurrent programs (threads especially) is perhaps the
single hardest thing in software engineering.  Debugging even very
simple multithreaded programs can be maddening because the simple act
of turning on debugging or turning off optimization can drastically
change how a bug behaves.

I'd love to help, but it would drive me insane....

Monty



--
Regards,
R. P. Janaka
_______________________________________________
theora-dev mailing list
theora-dev <at> xiph.org
http://lists.xiph.org/mailman/listinfo/theora-dev
Ralph Giles | 24 Apr 22:44
Favicon

Re: Theora got extreamly slow (Makefile.am was changed)

On 24-Apr-08, at 3:21 AM, R. P. Janaka wrote:

> AM_CFLAGS = -O2 -Wall $(DEFS) $(INCS)
> instead of
> CFLAGS = -O2 -Wall $(DEFS) $(INCS)

I can't say. AM_CFLAGS is probably more correct, but I don't see any  
bare CFLAGS assignments in the source, just those passed through  
recursive make for the debug and profile targets. Maybe one is  
getting more clobbered than the other?

  -r

Gmane