[FFmpeg-devel] mjpeg2jpeg_filter

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Dec 16 08:27:35 CET 2014

On Sun, Dec 14, 2014 at 08:10:31AM -0500, Don Moir wrote:
> I needed to convert AVI1 to normal jpeg. This happens a lot with camera streams and the code in mjpeg2jpeg_filter works fine.
> I was looking at the code in mjpeg2jpeg_filter in file mjpeg2jpeg_bsf.c and noticing that just creates a constant array of bytes each time for the replacement header.
> Unless I am missing something, those bytes could just be declared in a const array rather then building it each frame. Not sure if the values in the various const arrays are subject to change or not and just an observation.

Huh? The arrays themselves are all const.
If you mean you could merge them in one single array: Yes, that should
be possible.
However you still have to copy the data into the frame, so it's only a question
of doing 1 large memcpy vs. doing 8.
It to me seems unlikely the speed difference will even be measurable,
and it would replace code that is possible to understand by comparing
with the spec/the normal encoder with some obscure "magic numbers" array.
But if you think there is an advantage to doing it differently,
I'd expect a patch for discussion (or just discussion) would be welcome.

More information about the ffmpeg-devel mailing list