UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
10,059 Views
Registered: ‎03-22-2014

MJPEG on Zedboard

Jump to solution

hello,

 

after install Xillinux on ZedBoard, i want to run MJPEG decoder on this paltform

 

1- i can't found a source code of MJPEG ( serial and paralell version ), just i found MJPEG Streamer ( i try to run it on Zedboard, because i saw other user, have succefully this example )

 

2- have any one, idea or tried to run one thread of MJPEG ( parallel version ), using the PS and PL ( FPGA ) 

in other way, there is any dicumentation abut affecting thread to processor ( ARM in this case ), or to PL ?


thank you  for your help

 

 

My blog : www.xilinx-video.blogspot.com
Tags (5)
0 Kudos
1 Solution

Accepted Solutions
Scholar rfs613
Scholar
14,004 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
I've used the jpgsrc-6b package on Zynq (newer version here: http://www.ijg.org/). It is not the fastest, but the code is portable to x86, arm, powerpc, etc.

I have not used MJPEG, but it looks like ffmpeg might be a good starting point.

Of course there are probably many much more highly optimized choices, i'm not really familiar with them. After all, most mobile phones have ARM processors in them these days.
0 Kudos
21 Replies
Highlighted
Explorer
Explorer
10,037 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

update :

 

 

i readed all this discussion, really it's so nice to found people like you, answer on question, and try to foudn solution for people like us :) 

i have a project : run MJPEG on ZedBoard ( i use Xillinux ( based on Ubuntu 12.04)  as an OS with SMP )

i have the code source of MJPEg in 2 version ( serial and parallel ) 

 

1- have idea how, can i run or affect the .c fite to run just on the first CPU ( no problem CPU0 or CPU1), just i need to run this application on single CPU

2- the second version of MJPEG is parrelel, have you any idea, or previous example, where can we affect or run one thread on the PL , ( i didn't found any documentation about this )


also, i readed some other post similare to my question, one of its on  this link 

 

the following picture, show activities of the PS  ( 2 ARM )

Screenshot from 2014-05-08 13_02_34.png
thank you

My blog : www.xilinx-video.blogspot.com
Tags (5)
0 Kudos
Scholar rfs613
Scholar
10,033 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
1- The keyword you are looking for is "Processor Affinity". You can use the command "taskset" to control which CPU a task runs on. http://linuxcommand.org/man_pages/taskset1.html

2- This is non-trivial, you cannot just "convert" .c code to FPGA blocks. However you can likely find some PL logic that can be used to accelerate some portion of your encoding/decoding.
0 Kudos
Explorer
Explorer
10,028 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

 

hello,

 

thank you for your response

 

1- for the affinity, i found this post on forum, they talk about FreeOS, in my case i have Xillinux ( ubuntu), it's possible de make this manipulation on OS like ubuntu ?

 

 2- " convert", i don't think it's convert, i watcha demo from Avnet on ZedBoard, they try the OpenCv on Zynq, and they make a migration of some fonctionnality to PL ( check the follow video )

 




thank you

My blog : www.xilinx-video.blogspot.com
0 Kudos
Scholar rfs613
Scholar
10,022 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
1- the "settask" command is for Linux (which includes Ubuntu). As mentioned in the other forum post, generally the Linux scheduler is better than manually forcing the affinity. This is assuming you run linux on both CPUs. It is also possible run FreeRTOS (or something else) on one core -- that's a completely different thing though.

2- I'm not too familiar with OpenCV, I do know it can be used to offload some calculations, but it it's not "magic" solution to performance problems.
0 Kudos
Explorer
Explorer
10,020 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello,

 

thank you for your time to response, 

 

no problem for OpenCv, just i try to run it on ZedBoard, 

 

for the  use of a single processor, it's a recommandation of my responsible, i also, use Xillinux as an OS, after this step, i try th afinity method 

 

but i still can't found the source code of MJPEG or JPEG compatible for ARM architutre ( i found this but it's only for x86, i meet a problem in build, because it's for x86 ) 

2014-05-08 18_13_40.png

My blog : www.xilinx-video.blogspot.com
0 Kudos
Scholar rfs613
Scholar
14,005 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
I've used the jpgsrc-6b package on Zynq (newer version here: http://www.ijg.org/). It is not the fastest, but the code is portable to x86, arm, powerpc, etc.

I have not used MJPEG, but it looks like ffmpeg might be a good starting point.

Of course there are probably many much more highly optimized choices, i'm not really familiar with them. After all, most mobile phones have ARM processors in them these days.
0 Kudos
Explorer
Explorer
10,000 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello

 

thank you , it's work, i get the source code of the last version  of jpeg ( encoder and decoder )

 

i run it on ZYNQ and it's work :)

 

i begin to write a script to run djpeg on one CPU , usign the affinity proce

 

for the MJPEG, i think it's the same code, juste in the place of picture input, i will use a video file, ( because jpeg compatible with mpeg extenssion video file, or i will try to add some line code to accept video format as an input

 

BUT, i retur to my board, ( i delete the folder whitch cantain the extrct files ), i try tar -xvf jpegsrc.v9a.tar.gz ( again ), next i try make, make install, ./configure , but no positive result :(  , i can't found a reason , ( in the begin, it's work fine, with djpeg and cjpeg executable file, even i try some example ,and it's work 

please, can you check this problem 


erro configure jpeg-9a.png


thank you 

My blog : www.xilinx-video.blogspot.com
0 Kudos
Scholar rfs613
Scholar
9,977 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
Try setting the date/time of your board. It is likely in Jan 1st 1970 by default , because there is no real-time clock.
0 Kudos
Explorer
Explorer
9,968 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello 

My blog : www.xilinx-video.blogspot.com
0 Kudos
Explorer
Explorer
7,601 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello,

 

i try to use the taskset, but it's so dificult, because i can't get the PID of a task whitch isn't created yet :( , so i try other method, i just disactivate the second CPU :) 

check this method ( so simple ) 




My blog : www.xilinx-video.blogspot.com
0 Kudos
Scholar rfs613
Scholar
7,598 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
The PID is not necessary to use taskset. Just prefix your command like this:

taskset mask -- yourcommand args

0 Kudos
Explorer
Explorer
7,595 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello,

 

 

i tried to run , 

 

taskset -p 03 ./djpeg outfile sourcefile 

but i get error :  

 

taskset : failed to parse pid : ' sourcefile ' , 

 

i think taskset, can't support an execution command 

thank you

My blog : www.xilinx-video.blogspot.com
0 Kudos
Xilinx Employee
Xilinx Employee
7,592 Views
Registered: ‎03-13-2012

Re: MJPEG on Zedboard

Jump to solution

If you tell it to work with a PID, it requires a PID... Leave out the '-p'.

0 Kudos
Scholar rfs613
Scholar
7,591 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
Try like so:
taskset 0x03 -- ./djpeg outfile sourcefile

Note there are spaces on either side of the double-dash.
Tags (1)
0 Kudos
Explorer
Explorer
7,586 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello

 

same thing, i try your suggestion

 

Screenshot from 2014-05-11 18_30_04.png

My blog : www.xilinx-video.blogspot.com
0 Kudos
Explorer
Explorer
7,572 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello,

 

any suggestion, about taskset , please can you check my last screenshut 

 

i can't found the correct syntax of taskset, ( i tried taskset -help ) , but i can't found how can i runa command on cpu1 

thank you

My blog : www.xilinx-video.blogspot.com
0 Kudos
Scholar rfs613
Scholar
7,567 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
Seems your version does not like the double dash. Try it like this (as suggested by sorenb):

taskset 0x03 ./djpeg etc....
0 Kudos
Scholar rfs613
Scholar
7,563 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
Also, the value 0x03 selects both CPU #0 and #1.
It is a bit mask, each bit corresponds to one CPU.

So to run only on cpu1, you use 0x02.
0 Kudos
Explorer
Explorer
7,556 Views
Registered: ‎03-22-2014

Re: MJPEG on Zedboard

Jump to solution

hello, 

 

it's work, thank you :)

 

taskset 0x02 ./djpeg -outfile ./path/outputfile ./path/inputfile  ( this command work on terminal )  :)

but when i tried to use this command into script ( script.sh ) , i tried to run this command inti for ( loop ), for 50 loop ( as an example ) , i discovred that both of CPU, execute together this traitement, whitch mean ( taskset don't relly affect or force the traitment on signle processor, check the folowing picture (, look to CPU1 and CPU2  activities ), even when i use a simple commad without script ( i saw that 2 CPU run in the same time), bu to make sure if really those CPU work together , i use a script to run 50  repeated command 

 

the JPEG decoder still 20 seconds to run the decode of 50 image in JPG format 

thank you

Screenshot from 2014-05-13 13_32_49.png

My blog : www.xilinx-video.blogspot.com
Tags (3)
0 Kudos
Scholar rfs613
Scholar
3,222 Views
Registered: ‎05-28-2013

Re: MJPEG on Zedboard

Jump to solution
I wonder if some other task (file manager, thumbnail generator, etc) may be responsible for the second CPU becoming active. In other words, 'djpeg' process may be locked correctly to cpu1, but operating system is also running other processing on cpu2.

To test, you could run djpeg, but output to /dev/null, so that it only decodes, rather than generating any files.

It is also strange that the execution time of your program varies so much (12s to 38sec). For the same series of images, processing time should be virtually identical each time.
0 Kudos
Newbie farrionet
Newbie
1,672 Views
Registered: ‎09-04-2017

Re: MJPEG on Zedboard

Jump to solution

Excuse me guys,  this thread seems to be MJPEG related right? I also have a related question. Recently, I got a video of MJPEG from someone else and it was from a cam i think. I could not open it with our common players like Windows Media Player and VLC. Then, I find a converter in the article "http://www.videoconverterfactory.com/tips/mjpeg-converter.html". But here are the questions. I want to convert it to MP4, but I do not know how I can set the parameters. There are bit rate, resolution and frame rate. I want to know whether the higher bit rate and resolution I set, the better output it will be? What is the difference between bit  rate and resolution? I cannot figure it out by googling. Another question is should I choose MPEG4 or H264 as the output format, which one is better?

0 Kudos