[FFmpeg-devel] [PATCH 7/7] Handle AVID MJPEG streams directly in the MJPEG decoder.

James Almer jamrial at gmail.com
Tue Dec 15 03:04:35 EET 2020


On 12/14/2020 9:13 PM, Michael Niedermayer wrote:
> On Sat, Dec 12, 2020 at 04:45:55PM +0100, Anton Khirnov wrote:
>> AVID streams, currently handled by the AVRN decoder can be (depending on
>> extradata contents) either MJPEG or raw video. To decode the MJPEG
>> variant, the AVRN decoder currently instantiates a MJPEG decoder
>> internally and forwards decoded frames to the caller (possibly after
>> cropping them).
>>
>> This is suboptimal, because the AVRN decoder does not forward all the
>> features of the internal MJPEG decoder, such as direct rendering.
>> Handling such forwarding in a full and generic manner would be quite
>> hard, so it is simpler to just handle those streams in the MJPEG decoder
>> directly.
>>
>> The AVRN decoder, which now handles only the raw streams, can now be
>> marked as supporting direct rendering.
>>
>> This also removes the last remaining internal use of the obsolete
>> decoding API.
>> ---
>>   libavcodec/avrndec.c  | 74 ++-----------------------------------------
>>   libavcodec/mjpegdec.c | 11 +++++++
>>   libavcodec/version.h  |  2 +-
>>   libavformat/avidec.c  |  6 ++++
>>   libavformat/isom.c    |  2 +-
>>   libavformat/version.h |  2 +-
>>   tests/fate/video.mak  |  2 +-
>>   7 files changed, 23 insertions(+), 76 deletions(-)
> 
> breaks:
> ./ffmpeg -i ~/tickets/1527/24bpp.mov  whatever.mov
> 
> ...
> Press [q] to stop, [?] for help
> [avrn @ 0x5625d111bbc0] packet too small
> Error while decoding stream #0:0: Invalid data found when processing input
> [avrn @ 0x5625d111bbc0] packet too small
> Error while decoding stream #0:0: Invalid data found when processing input
> [avrn @ 0x5625d111bbc0] packet too small
> Error while decoding stream #0:0: Invalid data found when processing input
> [avrn @ 0x5625d111bbc0] packet too small

Reenabling...

> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index d1ef6e3407..db84bb417b 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -115,7 +115,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>  
>      { AV_CODEC_ID_MJPEG,  MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */
>      { AV_CODEC_ID_MJPEG,  MKTAG('m', 'j', 'p', 'a') }, /* Motion-JPEG (format A) */
> -    { AV_CODEC_ID_AVRN ,  MKTAG('A', 'V', 'D', 'J') }, /* MJPEG with alpha-channel (AVID JFIF meridien compressed) */
> +    { AV_CODEC_ID_MJPEG,  MKTAG('A', 'V', 'D', 'J') }, /* MJPEG with alpha-channel (AVID JFIF meridien compressed) */
>  /*  { AV_CODEC_ID_MJPEG,  MKTAG('A', 'V', 'R', 'n') }, *//* MJPEG with alpha-channel (AVID ABVB/Truevision NuVista) */

...this line here seems to fix it (The riff.c entry for AVRn selects the 
avrn decoder otherwise).


More information about the ffmpeg-devel mailing list