Opened 18 months ago
Last modified 18 months ago
#10012 new defect
rkmppdec improperly judging interlaced source
Reported by: | tc | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | unspecified | Keywords: | interlaced |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/rkmppdec.c#L407
frame->interlaced_frame = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_DEINTERLACED);
my understanding of frame->interlaced is that it should be non-zero when input frames are interlaced.
mpp_frame_get_mode(mppframe)
returns a bitfield covered by mpp_frame.h
:
#define MPP_FRAME_FLAG_TOP_FIELD (0x00000001) /* bottom field only */ #define MPP_FRAME_FLAG_BOT_FIELD (0x00000002) /* paired field */ #define MPP_FRAME_FLAG_PAIRED_FIELD (MPP_FRAME_FLAG_TOP_FIELD|MPP_FRAME_FLAG_BOT_FIELD) /* paired field with field order of top first */ #define MPP_FRAME_FLAG_TOP_FIRST (0x00000004) /* paired field with field order of bottom first */ #define MPP_FRAME_FLAG_BOT_FIRST (0x00000008) /* paired field with unknown field order (MBAFF) */ #define MPP_FRAME_FLAG_DEINTERLACED (MPP_FRAME_FLAG_TOP_FIRST|MPP_FRAME_FLAG_BOT_FIRST) #define MPP_FRAME_FLAG_FIELD_ORDER_MASK (0x0000000C)
For a typical tff interlaced source, returned mode is 0x7
(0b111
). For bff, it would be 0b1011
.
However, MPP_FRAME_FLAG_DEINTERLACED masks both TFF and BFF, which is impossible in interlaced sources.
As per discussion here: https://github.com/JeffyCN/FFmpeg/issues/10
the correct logic would be inverse of current, i.e.
frame->interlaced_frame = (mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK);
After making this change, the stream is properly marked as interlaced:
Stream #0:0: Video: h264, drm_prime(bt709, top coded first (swapped)), 1440x1080, q=2-31, 3000 kb/s, 29.97 fps, 90k tbn
Change History (3)
comment:1 by , 18 months ago
Description: | modified (diff) |
---|
comment:2 by , 18 months ago
comment:3 by , 18 months ago
Sorry, I don't have access to mailing list or a way to make a patch. I've posted the change and asking for comment/feedback whether this is reasonable or not.
It's up to the maintainer(s) to decide what to do with this information.
Please send your patch - made with git format-patch - to the FFmpeg development mailing list.