Message ID | 3d23ea94-ad5e-e447-f368-7f451b4ddc6a@carpalis.nl |
---|---|
State | New |
Headers | show |
2018-10-23 14:50 GMT+02:00, Jerome Borsboom <jerome.borsboom@carpalis.nl>: > vc1_decode_frame assumes that ticks_per_frame is set to two when RFF > or RPTFRM is set. When FRAMERATE_FLAG is zero, this may not be the case > as the setting of ticks_per_frame is guarded by FRAMERATE_FLAG. Is there a specific sample that gets fixed? Carl Eugen
> 2018-10-23 14:50 GMT+02:00, Jerome Borsboom <jerome.borsboom at carpalis.nl>: >> vc1_decode_frame assumes that ticks_per_frame is set to two when RFF >> or RPTFRM is set. When FRAMERATE_FLAG is zero, this may not be the case >> as the setting of ticks_per_frame is guarded by FRAMERATE_FLAG. > > Is there a specific sample that gets fixed? > > Carl Eugen Please compare ffprobe -i SA10160.vc1 -show_packets and ffprobe -i SA10161.vc1 -show_packets SA10160.vc1 repeats each frame by setting RPTFRM to 1 for each frame, while SA10161.vc1 has RPTFRM set to 0 for each frame. Both files do not have a framerate encoded (FRAMERATE_FLAG = 0). Without the patch, both files produce frames with duration_time=0.040000. With the patch, the SA10160.vc1 file produces frames with duration_time=0.080000, which is double the duration_time of the SA10161.vc1 file and, hence, honours the RPTFRM flag. Regards, Jerome
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 3581d87b57..09433ad3e9 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -422,6 +422,9 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) v->max_coded_width = (get_bits(gb, 12) + 1) << 1; v->max_coded_height = (get_bits(gb, 12) + 1) << 1; v->broadcast = get_bits1(gb); + if (v->broadcast) // Pulldown may be present + v->s.avctx->ticks_per_frame = 2; + v->interlace = get_bits1(gb); v->tfcntrflag = get_bits1(gb); v->finterpflag = get_bits1(gb); @@ -480,9 +483,6 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) v->s.avctx->framerate.num = ff_vc1_fps_nr[nr - 1] * 1000; } } - if (v->broadcast) { // Pulldown may be present - v->s.avctx->ticks_per_frame = 2; - } } if (get_bits1(gb)) {
vc1_decode_frame assumes that ticks_per_frame is set to two when RFF or RPTFRM is set. When FRAMERATE_FLAG is zero, this may not be the case as the setting of ticks_per_frame is guarded by FRAMERATE_FLAG. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl> --- libavcodec/vc1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)