On 2/27/2021 1:37 PM, James Almer wrote:
On 2/27/2021 1:33 PM, Michael Niedermayer wrote:
On Wed, Feb 24, 2021 at 11:25:42AM +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.
---
And now without the missing isom tag change. Thanks to Andreas for noticing.
---
  configure               |  1 -
  libavcodec/avrndec.c    | 71 +----------------------------------------
  libavcodec/mjpegdec.c   | 11 +++++++
  libavcodec/version.h    |  2 +-
  libavformat/avidec.c    |  6 ++++
  libavformat/isom_tags.c |  4 +--
  tests/fate/video.mak    |  2 +-
  7 files changed, 22 insertions(+), 75 deletions(-)

breaks:
./ffmpeg -vlowres 2 -i ~/tickets/162/avid.avi  -vframes 3 avrn.avi

The outputed image is several times bigger and looks as if it encodes random bits od memory

Can you try again with git head? I removed the max_lowres value since the avrn raw decoder doesn't support it, since it was pulled from the mjpeg version.

Ok, the above was unrelated since this sample is mjpeg, now raw.
The following however fixes it for me:

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 79c7d6e6cf..8eed8eefe6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2863,8 +2863,8 @@ the_end:
     if ((avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
          avctx->codec_tag == MKTAG('A', 'V', 'D', 'J')) &&
         avctx->coded_height > s->orig_height) {
-        frame->height   = avctx->coded_height;
-        frame->crop_top = frame->height - s->orig_height;
+        frame->height   = AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres);
+        frame->crop_top = frame->height - AV_CEIL_RSHIFT(s->orig_height, 
avctx->lowres);

But it may be an incomplete solution, since there's another similar check/assignment in ff_mjpeg_decode_sof() also added by 9e4225cf7f.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to