Multi-thread in libvpx1.0.0 simple decoder on panda board

118 views
Skip to first unread message

satish kumar

unread,
Mar 29, 2012, 7:11:23 AM3/29/12
to WebM Discussion
Hi,
i have compile the libvpx 1.0.0 library on panda board with ubuntu
image (omap 4430,cortex- a9 dual core)with the following options.
./configure --target=armv7-linux-gcc
make
I generated a stream with two partitions by encoder.
I am not getting any performance improvement when i run ./
simple_decoder with multi thread option enabled.


can one help in this regard.
thanks in advance.



Regards,
Satish


Johann Koenig

unread,
Mar 29, 2012, 12:16:53 PM3/29/12
to webm-d...@webmproject.org
On Thu, Mar 29, 2012 at 04:11, satish kumar <sati...@gmail.com> wrote:
> I am not getting any performance improvement when i run ./
> simple_decoder with multi thread option enabled.

How are you specifying the multi thread option? Have you tried vpxdec -t 2?
--
- johann koenig
  google

satish kumar

unread,
Apr 3, 2012, 5:39:16 AM4/3/12
to WebM Discussion
Hi johann,
i tried with simple_decoder executable.

with the following code i am able creating two threads.
One is main thread and other is child thread.


simple_decoder.c
____________________

vpx_codec_dec_cfg_t cfg = {0};
cfg.threads = 2;


/* Initialize codec
*/ //
if(vpx_codec_dec_init(&codec, interface, &cfg,
flags)) //
die_codec(&codec, "Failed to initialize
decoder"); //

while running threads i am able to see them on console by using htop
command.
But i am not seeing which thread is running on which core.

is there any command which thread is running on which core ?
I am taking performance cycles in the following way.

Used cortex-a8 timer registers.

PerfReset(1); //reset timer
lCount1 = PerfGetCount(0xff); //get timer count


/* Decode the frame
*/ //
if(vpx_codec_decode(&codec, frame, frame_sz, NULL,
0)) //
die_codec(&codec, "Failed to decode
frame"); //


lCount2 = PerfGetCount(0xff); //get timer count
lTotCycles = lCount2 - lCount1; //total cycles

For every frame i am taking cycles and resetting the timer for next
frame.

please correct me if i am doing any thing wrong.


Thank you in advance.

regards,
satish





On Mar 29, 9:16 pm, Johann Koenig <johannkoe...@google.com> wrote:

satish kumar

unread,
Apr 3, 2012, 3:05:13 AM4/3/12
to WebM Discussion
Hi johann ,
i tried with ./simple_decoder executable.
Actually code is creating multiple threads when i assign cfg.threads =
2 and pass it to the following code.

simple_decoder.c
________________

vpx_codec_dec_cfg_t cfg = {0};
cfg.threads = 2;
/* Initialize codec
*/ //
if(vpx_codec_dec_init(&codec, interface, &cfg,
flags)) //
die_codec(&codec, "Failed to initialize
decoder"); //


i able to see the mulitple therads running on board using htop
command.
But i not able see which thread is running on which core.
i am taking performance cycles in the following way .

PerfReset(1);
lCount1 = PerfGetCount(0xff);


/* Decode the frame
*/ //
if(vpx_codec_decode(&codec, frame, frame_sz, NULL,
0)) //
die_codec(&codec, "Failed to decode
frame"); //


lCount2 = PerfGetCount(0xff);
lTotCycles = lCount2 - lCount1;


please correct if i am doing anything wrong.

Thanx in advance.

satish
Incube solutions



On Mar 29, 9:16 pm, Johann Koenig <johannkoe...@google.com> wrote:

Johann Koenig

unread,
Apr 3, 2012, 1:20:56 PM4/3/12
to webm-d...@webmproject.org
On Tue, Apr 3, 2012 at 00:05, satish kumar <sati...@gmail.com> wrote:
> i able to see the mulitple therads running on board using htop
> command.
> But i not able see which thread is running on which core.
> i am taking performance cycles in the following way .

What makes you think that it is not decoding any faster? I am not
familiar with the functions you are using: PerfReset, PerfGetCount.

satish kumar

unread,
Apr 5, 2012, 12:00:22 AM4/5/12
to WebM Discussion
I measured performance cycles for both single thread and two threads.
Cycles that i am getting for single thread are less than what i am
getting for two threads.
when i run multiple times it's giving random cycle count ,am not
getting consistent cycle count.
Is this code running parallelly on two cores ?



regards,
satish

On Apr 3, 10:20 pm, Johann Koenig <johannkoe...@google.com> wrote:

Attila Nagy

unread,
Apr 5, 2012, 2:49:33 AM4/5/12
to webm-d...@webmproject.org
Hi,

The CPU cycles required to decode a stream is more or less constant. 
In order to speed up the decoding one can split the operations into threads and run them concurrently on multiple cores.
The total amount of cycles consumed are actually more for multithread as this requires extra code.

You should measure the time it takes to decode. You should see a a speedup factor of at least 1.5 when running with 2 threads.

Regards,
-Atti 


--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.


satish kumar

unread,
Apr 5, 2012, 3:07:26 AM4/5/12
to WebM Discussion
Hi,
How to measure the decode time with out including thread code ?
Is there any performance tools ?
when i run, i am getting different thread ids.If two threads are
created in one process, process id should
be same for both threads.

correct me if anything is wrong.


Regards,
satish
> > To post to this group, send email to webm-disc...@webmproject.org.
> > To unsubscribe from this group, send email to
> > webm-discuss+unsubscr...@webmproject.org.
> > For more options, visit this group at
> >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.- Hide quoted text -
>
> - Show quoted text -

Attila Nagy

unread,
Apr 5, 2012, 3:46:18 AM4/5/12
to webm-d...@webmproject.org
You can profile the whole process with 'perf' from linux-kernel-tools.

Thread IDs are unique for each thread within a process.
Process ID as returned by getpid() is same for all child threads.

-Atti

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 9, 2012, 10:25:01 AM4/9/12
to WebM Discussion
Thanks for ur quick reply.
I am using ubuntu 11.10 ,
when i type "perf" command, it asks to install linux-tools-common
After installation again it shows following error
" perf_3.1.0-1282 not found
You may need to install linux-tools-3.1.0-1282 "

Do i need to install this ?

i have 3.1.0-1282-omap4 tools.

Thanx in advance.

Regards,
Satish
> > > >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en....quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "WebM Discussion" group.

Johann Koenig

unread,
Apr 9, 2012, 11:14:46 AM4/9/12
to webm-d...@webmproject.org
On Mon, Apr 9, 2012 at 07:25, satish kumar <sati...@gmail.com> wrote:
> Thanks for ur quick reply.
> I am using ubuntu 11.10 ,

If you are only concerned about the overall execution time it may be
easier to use 'time':
http://linux.die.net/man/1/time

satish kumar

unread,
Apr 10, 2012, 2:37:59 AM4/10/12
to WebM Discussion

1).what is the procedure to ensure multiple thread vp8 simple_decoder
is running faster than single thread on omap4430 panda board with
ubuntu 11.10 image?


Regards,
Satish


On Apr 9, 8:14 pm, Johann Koenig <johannkoe...@google.com> wrote:

Attila Nagy

unread,
Apr 10, 2012, 3:45:25 AM4/10/12
to webm-d...@webmproject.org
As long as your input stream has multiple token partitions, the multi-threaded decoder is significantly faster than the single threaded one.
Try to use the full vpxdec application, where you can specify the number of threads on the command line.

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 10, 2012, 6:22:54 AM4/10/12
to WebM Discussion
With the vpxdec also multi thread is taking more time.

For multi thread,
./vpxdec -o test.yuv -t 2 --summary --progress
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

3768 decoded frames/3768 showed frames in 7246305 us (519.99 fps)



For single thread,
./vpxdec -o test.yuv -t 0 --summary --progress
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

3768 decoded frames/3768 showed frames in 5134852 us (733.81 fps)


regards,
satish


On Apr 10, 12:45 pm, Attila Nagy <attilan...@google.com> wrote:
> As long as your input stream has multiple token partitions, the
> multi-threaded decoder is significantly faster than the single threaded one.
> Try to use the full vpxdec application, where you can specify the number of
> threads on the command line.
>
>
>
>
>
>
>
> On Tue, Apr 10, 2012 at 9:37 AM, satish kumar <satish...@gmail.com> wrote:
>
> > 1).what is the procedure to ensure multiple thread vp8 simple_decoder
> > is running faster than single thread on omap4430 panda board with
> > ubuntu 11.10 image?
>
> > Regards,
> > Satish
>
> > On Apr 9, 8:14 pm, Johann Koenig <johannkoe...@google.com> wrote:
> > > On Mon, Apr 9, 2012 at 07:25, satish kumar <satish...@gmail.com> wrote:
> > > > Thanks for ur quick reply.
> > > > I am using ubuntu 11.10 ,
>
> > > If you are only concerned about the overall execution time it may be
> > > easier to use 'time':http://linux.die.net/man/1/time
> > > --
> > > - johann koenig
> > >   google
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "WebM Discussion" group.
> > To post to this group, send email to webm-disc...@webmproject.org.
> > To unsubscribe from this group, send email to
> > webm-discuss+unsubscr...@webmproject.org.

Attila Nagy

unread,
Apr 10, 2012, 6:28:50 AM4/10/12
to webm-d...@webmproject.org
can you post your test stream somewhere?

I have a pandaboard running
"Linux linaro-ubuntu-desktop 3.1.1-29-linaro-lt-omap #29~lt~ci~20120328002449+1332949706~4f7349b0-Ubuntu SMP PREEMPT  armv7l armv7l armv7l GNU/Linux"


To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 10, 2012, 9:59:22 AM4/10/12
to WebM Discussion
you can download at below link,
http://www.mediafire.com/?upai32l10m5o517

It is QCIF resolution stream and has 4 partitions.


regards,
satish
> >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.- Hide quoted text -

Johann Koenig

unread,
Apr 10, 2012, 12:57:18 PM4/10/12
to webm-d...@webmproject.org
On Tue, Apr 10, 2012 at 03:22, satish kumar <sati...@gmail.com> wrote:
> For single thread,
> ./vpxdec -o test.yuv -t 0 --summary --progress
> Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

Looking through the code I don't think '-t 0' autodetects the threads
... but can you try '-t 1'?

satish kumar

unread,
Apr 11, 2012, 12:09:38 AM4/11/12
to WebM Discussion
-t arguments should be greater than 2 then only it will create child
thread.
If -t 0 or 1 it will not process rows parallely on different
cores.Because
there is a check in " vp8_decoder_create_threads " function in
threading.c file to create threads.


Regards,
satish

On Apr 10, 9:57 pm, Johann Koenig <johannkoe...@google.com> wrote:

Attila Nagy

unread,
Apr 11, 2012, 2:41:30 AM4/11/12
to webm-d...@webmproject.org
Hi,

Quick test on pandaboard&ubuntu:

./vpxdec -t 0 --noblit  --summary -v Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8 
WebM Project VP8 Decoder v1.0.0-113-g6b7cf30
3768 decoded frames/3768 showed frames in 4766077 us (790.59 fps)

./vpxdec -t 2 --noblit  --summary -v Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8 
WebM Project VP8 Decoder v1.0.0-113-g6b7cf30
3768 decoded frames/3768 showed frames in 3320803 us (1134.67 fps)

libvpx configuration: ./configure --target=armv7-linux-gcc

-Atti

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 11, 2012, 3:21:12 AM4/11/12
to WebM Discussion
Thank you Attila i got ur results,

The only difference between your opptions and my options is --
progress.
With this option single thread is taking less time than multiple
threads.
Can you explain why it happens ?

Regards,
Satish
> > > >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en....quoted text -

Attila Nagy

unread,
Apr 11, 2012, 3:32:08 AM4/11/12
to webm-d...@webmproject.org
--progress does not make any difference:

./vpxdec -t 2 --noblit  --progress -v Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8 
WebM Project VP8 Decoder v1.0.0-113-g6b7cf30
3768 decoded frames/3768 showed frames in 3610985 us (1043.48 fps)

what kernel are you running? we have seen scheduler issues with some older omap kernels

-Atti

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 11, 2012, 4:05:00 AM4/11/12
to WebM Discussion
Hi,
Kernel version - 3.1.0-1282-omap4
Ubuntu 11.10

Regards,
satish
> >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en....-

Attila Nagy

unread,
Apr 11, 2012, 4:37:48 AM4/11/12
to webm-d...@webmproject.org
Try updating your kernel from the Linaro ppa.
To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

Franco Tecchia

unread,
Apr 11, 2012, 2:52:15 AM4/11/12
to webm-d...@webmproject.org
Hi,

very useful. What about encoding speed?

John Koleszar

unread,
Apr 11, 2012, 12:46:25 PM4/11/12
to webm-d...@webmproject.org
Also, do you see the same behavior if you use --noblit instead of -o test.y4m?

satish kumar

unread,
Apr 12, 2012, 6:42:33 AM4/12/12
to WebM Discussion
Hi ,
I am not getting same behavior what i got with --progress,

With --noblit

./vpxdec -t 2 --noblit --summary -v
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

WebM Project VP8 Decoder v1.0.0
3768 decoded frames/3768 showed frames in 3405662 us (1106.39 fps)

./vpxdec -t 0 --noblit --summary -v
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

WebM Project VP8 Decoder v1.0.0
3768 decoded frames/3768 showed frames in 4914463 us (766.72 fps)




With -o test.y4m


./vpxdec -t 2 -o test.y4m --summary -v
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

WebM Project VP8 Decoder v1.0.0
3768 decoded frames/3768 showed frames in 3936380 us (957.22 fps)

./vpxdec -t 0 -o test.y4m --summary -v
Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8

WebM Project VP8 Decoder v1.0.0
3768 decoded frames/3768 showed frames in 5653599 us (666.48 fps)



Regards,
satish

On Apr 11, 9:46 pm, John Koleszar <jkoles...@google.com> wrote:
> Also, do you see the same behavior if you use --noblit instead of -o test.y4m?
>
>
>
>
>
>
>
> On Wed, Apr 11, 2012 at 12:32 AM, Attila Nagy <attilan...@google.com> wrote:
> > --progress does not make any difference:
>
> > ./vpxdec -t 2 --noblit  --progress -v
> > Why_this_kolaveri_di_Female_Version_cover_by_Gigda.vp8
> > WebM Project VP8 Decoder v1.0.0-113-g6b7cf30
> > 3768 decoded frames/3768 showed frames in 3610985 us (1043.48 fps)
>
> > what kernel are you running? we have seen scheduler issues with some older
> > omap kernels
>
> > -Atti
>
> >> > > > > text -
>
> >> > > > - Show quoted text -
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> > > Groups
> >> > > "WebM Discussion" group.
> >> > > To post to this group, send email to webm-disc...@webmproject.org.
> >> > > To unsubscribe from this group, send email to
> >> > > webm-discuss+unsubscr...@webmproject.org.
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.-
> >> > > Hide quoted text -
>
> >> > - Show quoted text -
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "WebM Discussion" group.
> >> To post to this group, send email to webm-disc...@webmproject.org.

Attila Nagy

unread,
Apr 12, 2012, 6:47:18 AM4/12/12
to webm-d...@webmproject.org
Ok, you have 2 threads faster than 1. Is it all sorted then?

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

John Koleszar

unread,
Apr 12, 2012, 1:03:16 PM4/12/12
to webm-d...@webmproject.org
Ok, that looks right to me. The issue with --progress is curious, but
points to either the kernel or something about your userland. The
codec seems to be working ok.

> To post to this group, send email to webm-d...@webmproject.org.
> To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 13, 2012, 4:06:32 AM4/13/12
to WebM Discussion
what ever time it showing is system time.
In that time parallelly some other threads also running on the board
other than vp8 threads.
So CPU time is utilized by some other work.
I want to measure that VP8 decoder alone takes howmany MHZ on coretex-
a9 dual core.
As per my understanding the clock timers for cortex-a8 and cortex-a9
are same.
If i use this timer to calculate MHz,single thread is taking less
cycles than multiple threads.
Can you have vp8 data sheet either cortex-a9 dual core or cortex-a8 ?
> > To post to this group, send email to webm-disc...@webmproject.org.
> > To unsubscribe from this group, send email to webm-discuss+unsubscr...@webmproject.org.
> > For more options, visit this group athttp://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.- Hide quoted text -

John Koleszar

unread,
Apr 13, 2012, 11:09:59 AM4/13/12
to webm-d...@webmproject.org
It's expected that running multiple threads requires more cycles since
you have to do extra work for syncronization etc, but since they run
in parallel, you should see a reduction in wall clock time.

> To post to this group, send email to webm-d...@webmproject.org.
> To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 16, 2012, 4:30:14 AM4/16/12
to WebM Discussion
Thanx for reply .
I am measuring cycles using cortex-a8 performance registers.
It is giving more cycles for multithread than single thread.
Is that includes synchronization timing ?

present code doing decode_mb_tokens and decode_macroblock on single
core even if we have multiple cores for single partition.
1).can i do decode_mb_tokens on multiple cores even if we have single
partition ?
2).can i do decode_macroblock in wavefront order on multiple cores
even if we have single partition ?

will these give any better performance results if cache misses are
less ?

Is there any document which exaplains multithread code ?
> >> > For more options, visit this group athttp://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.-Hide quoted- Hide quoted text -
>
> - Show quoted text -...
>
> read more »

Attila Nagy

unread,
Apr 16, 2012, 5:38:03 AM4/16/12
to webm-d...@webmproject.org
Hi,

On Mon, Apr 16, 2012 at 11:30 AM, satish kumar <sati...@gmail.com> wrote:
Thanx for reply .
I am measuring cycles using cortex-a8 performance registers.
It is giving more cycles for multithread than single thread.
Is that includes synchronization timing ?


It is normal.
 
present code doing decode_mb_tokens and decode_macroblock on single
core even if we have multiple cores for single partition.
1).can i do decode_mb_tokens on multiple cores even if we have single
partition ?

no, you cannot. all tokens encoded with one bool coder.
 
2).can i do decode_macroblock in wavefront order on multiple cores
even if we have single partition ?

you cannot do this because tokens are decoded in raster scan order.
or you could do it after decoding all tokens...

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
Apr 16, 2012, 6:54:04 AM4/16/12
to WebM Discussion
Hi,
So if i take out the decoding_mb_tokens from the row column loop.
First i do the frame level decoding_mb_tokens based on single
partition(single core) or multiple partitions(on multiple core)
and then do the decoding macroblock in wavefront order as the present
code do.
with this can i get better performance ? or cache misses will
compensate this?

I am seeing only single partition streams in webm site.
where i can find multiple partition VP8 streams ?



On Apr 16, 2:38 pm, Attila Nagy <attilan...@google.com> wrote:
> Hi,
>
> > > >> >> >> > > You received this message...
>
> read more »

Attila Nagy

unread,
Apr 16, 2012, 7:45:06 AM4/16/12
to webm-d...@webmproject.org
youtube videos should be all multi-partitioned.

To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.

satish kumar

unread,
May 7, 2012, 8:40:46 AM5/7/12
to WebM Discussion
Hi Attila,
I downloaded webm videos from the following URL through www.keepvid.com
website,

http://www.youtube.com/results?search_query=trailers&webm=1&

Downloaded webm videos have different partitions based on the
resolution.
most of the streams contain,
720p - 4 partitions
480p - 2 partitions
360 - 2 partitions

Does the ortiginal uploaded streams contains partitions (or) keepvide
is making these assumptions ?

Can't we find single partition streams ?

Could you please explain.

Regards,
Satish


On Apr 16, 4:45 pm, Attila Nagy <attilan...@google.com> wrote:
> youtube videos should be all multi-partitioned....
>
> read more »
> > > >http://linux.die.net/man/1/time- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages