You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpegvideo: Move flipflop_rounding to {MSMPEG4Dec,MPVEnc}Context
Forgotten in 9964212545
.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -265,7 +265,6 @@ typedef struct MpegEncContext {
|
|||||||
/* MSMPEG4 specific */
|
/* MSMPEG4 specific */
|
||||||
int slice_height; ///< in macroblocks
|
int slice_height; ///< in macroblocks
|
||||||
int first_slice_line; ///< used in MPEG-4 too to handle resync markers
|
int first_slice_line; ///< used in MPEG-4 too to handle resync markers
|
||||||
int flipflop_rounding;
|
|
||||||
enum {
|
enum {
|
||||||
MSMP4_UNUSED,
|
MSMP4_UNUSED,
|
||||||
MSMP4_V1,
|
MSMP4_V1,
|
||||||
|
@ -927,7 +927,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
s->c.modified_quant = s->c.h263_aic;
|
s->c.modified_quant = s->c.h263_aic;
|
||||||
s->c.loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
s->c.loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||||
s->c.unrestricted_mv = s->c.obmc || s->c.loop_filter || s->c.umvplus;
|
s->c.unrestricted_mv = s->c.obmc || s->c.loop_filter || s->c.umvplus;
|
||||||
s->c.flipflop_rounding = 1;
|
s->flipflop_rounding = 1;
|
||||||
|
|
||||||
/* /Fx */
|
/* /Fx */
|
||||||
/* These are just to be sure */
|
/* These are just to be sure */
|
||||||
@ -968,7 +968,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
s->c.out_format = FMT_H263;
|
s->c.out_format = FMT_H263;
|
||||||
s->c.h263_pred = 1;
|
s->c.h263_pred = 1;
|
||||||
s->c.unrestricted_mv = 1;
|
s->c.unrestricted_mv = 1;
|
||||||
s->c.flipflop_rounding = 1;
|
s->flipflop_rounding = 1;
|
||||||
s->c.low_delay = m->max_b_frames ? 0 : 1;
|
s->c.low_delay = m->max_b_frames ? 0 : 1;
|
||||||
avctx->delay = s->c.low_delay ? 0 : (m->max_b_frames + 1);
|
avctx->delay = s->c.low_delay ? 0 : (m->max_b_frames + 1);
|
||||||
break;
|
break;
|
||||||
@ -985,7 +985,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
s->c.h263_pred = 1;
|
s->c.h263_pred = 1;
|
||||||
s->c.unrestricted_mv = 1;
|
s->c.unrestricted_mv = 1;
|
||||||
s->c.msmpeg4_version = MSMP4_V3;
|
s->c.msmpeg4_version = MSMP4_V3;
|
||||||
s->c.flipflop_rounding = 1;
|
s->flipflop_rounding = 1;
|
||||||
avctx->delay = 0;
|
avctx->delay = 0;
|
||||||
s->c.low_delay = 1;
|
s->c.low_delay = 1;
|
||||||
break;
|
break;
|
||||||
@ -994,7 +994,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
s->c.h263_pred = 1;
|
s->c.h263_pred = 1;
|
||||||
s->c.unrestricted_mv = 1;
|
s->c.unrestricted_mv = 1;
|
||||||
s->c.msmpeg4_version = MSMP4_WMV1;
|
s->c.msmpeg4_version = MSMP4_WMV1;
|
||||||
s->c.flipflop_rounding = 1;
|
s->flipflop_rounding = 1;
|
||||||
avctx->delay = 0;
|
avctx->delay = 0;
|
||||||
s->c.low_delay = 1;
|
s->c.low_delay = 1;
|
||||||
break;
|
break;
|
||||||
@ -1003,7 +1003,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
s->c.h263_pred = 1;
|
s->c.h263_pred = 1;
|
||||||
s->c.unrestricted_mv = 1;
|
s->c.unrestricted_mv = 1;
|
||||||
s->c.msmpeg4_version = MSMP4_WMV2;
|
s->c.msmpeg4_version = MSMP4_WMV2;
|
||||||
s->c.flipflop_rounding = 1;
|
s->flipflop_rounding = 1;
|
||||||
avctx->delay = 0;
|
avctx->delay = 0;
|
||||||
s->c.low_delay = 1;
|
s->c.low_delay = 1;
|
||||||
break;
|
break;
|
||||||
@ -2022,7 +2022,7 @@ vbv_retry:
|
|||||||
s->c.mb_skipped = 0; // done in frame_start()
|
s->c.mb_skipped = 0; // done in frame_start()
|
||||||
// done in encode_picture() so we must undo it
|
// done in encode_picture() so we must undo it
|
||||||
if (s->c.pict_type == AV_PICTURE_TYPE_P) {
|
if (s->c.pict_type == AV_PICTURE_TYPE_P) {
|
||||||
s->c.no_rounding ^= s->c.flipflop_rounding;
|
s->c.no_rounding ^= s->flipflop_rounding;
|
||||||
}
|
}
|
||||||
if (s->c.pict_type != AV_PICTURE_TYPE_B) {
|
if (s->c.pict_type != AV_PICTURE_TYPE_B) {
|
||||||
s->c.time_base = s->c.last_time_base;
|
s->c.time_base = s->c.last_time_base;
|
||||||
@ -3734,7 +3734,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
|
|||||||
if (s->c.pict_type == AV_PICTURE_TYPE_I) {
|
if (s->c.pict_type == AV_PICTURE_TYPE_I) {
|
||||||
s->c.no_rounding = s->c.msmpeg4_version >= MSMP4_V3;
|
s->c.no_rounding = s->c.msmpeg4_version >= MSMP4_V3;
|
||||||
} else if (s->c.pict_type != AV_PICTURE_TYPE_B) {
|
} else if (s->c.pict_type != AV_PICTURE_TYPE_B) {
|
||||||
s->c.no_rounding ^= s->c.flipflop_rounding;
|
s->c.no_rounding ^= s->flipflop_rounding;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->c.avctx->flags & AV_CODEC_FLAG_PASS2) {
|
if (s->c.avctx->flags & AV_CODEC_FLAG_PASS2) {
|
||||||
|
@ -155,6 +155,7 @@ typedef struct MPVEncContext {
|
|||||||
PutBitContext pb2; ///< used for data partitioned VOPs
|
PutBitContext pb2; ///< used for data partitioned VOPs
|
||||||
|
|
||||||
/* MSMPEG4 specific */
|
/* MSMPEG4 specific */
|
||||||
|
int flipflop_rounding; ///< also used for MPEG-4, H.263+
|
||||||
int esc3_level_length;
|
int esc3_level_length;
|
||||||
|
|
||||||
/* RTP specific */
|
/* RTP specific */
|
||||||
|
@ -544,7 +544,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s)
|
|||||||
ms->per_mb_rl_table,
|
ms->per_mb_rl_table,
|
||||||
s->qscale);
|
s->qscale);
|
||||||
|
|
||||||
if(s->flipflop_rounding){
|
if (ms->flipflop_rounding) {
|
||||||
s->no_rounding ^= 1;
|
s->no_rounding ^= 1;
|
||||||
}else{
|
}else{
|
||||||
s->no_rounding = 0;
|
s->no_rounding = 0;
|
||||||
@ -570,13 +570,13 @@ int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
|
|||||||
skip_bits(&s->gb, 5); /* fps */
|
skip_bits(&s->gb, 5); /* fps */
|
||||||
ms->bit_rate = get_bits(&s->gb, 11) * 1024;
|
ms->bit_rate = get_bits(&s->gb, 11) * 1024;
|
||||||
if (s->msmpeg4_version >= MSMP4_V3)
|
if (s->msmpeg4_version >= MSMP4_V3)
|
||||||
s->flipflop_rounding= get_bits1(&s->gb);
|
ms->flipflop_rounding = get_bits1(&s->gb);
|
||||||
else
|
else
|
||||||
s->flipflop_rounding= 0;
|
ms->flipflop_rounding = 0;
|
||||||
}
|
}
|
||||||
else if(left<length+8)
|
else if(left<length+8)
|
||||||
{
|
{
|
||||||
s->flipflop_rounding= 0;
|
ms->flipflop_rounding = 0;
|
||||||
if (s->msmpeg4_version != MSMP4_V2)
|
if (s->msmpeg4_version != MSMP4_V2)
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
|
av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
typedef struct MSMP4DecContext {
|
typedef struct MSMP4DecContext {
|
||||||
MpegEncContext m;
|
MpegEncContext m;
|
||||||
int bit_rate;
|
int bit_rate;
|
||||||
|
int flipflop_rounding;
|
||||||
int mv_table_index;
|
int mv_table_index;
|
||||||
int rl_table_index;
|
int rl_table_index;
|
||||||
int rl_chroma_table_index;
|
int rl_chroma_table_index;
|
||||||
|
@ -298,9 +298,9 @@ void ff_msmpeg4_encode_ext_header(MPVEncContext *const s)
|
|||||||
put_bits(&s->pb, 11, FFMIN(m->bit_rate / 1024, 2047));
|
put_bits(&s->pb, 11, FFMIN(m->bit_rate / 1024, 2047));
|
||||||
|
|
||||||
if (s->c.msmpeg4_version >= MSMP4_V3)
|
if (s->c.msmpeg4_version >= MSMP4_V3)
|
||||||
put_bits(&s->pb, 1, s->c.flipflop_rounding);
|
put_bits(&s->pb, 1, s->flipflop_rounding);
|
||||||
else
|
else
|
||||||
av_assert0(!s->c.flipflop_rounding);
|
av_assert0(!s->flipflop_rounding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_msmpeg4_encode_motion(MSMPEG4EncContext *const ms,
|
void ff_msmpeg4_encode_motion(MSMPEG4EncContext *const ms,
|
||||||
|
@ -94,7 +94,7 @@ static int wmv2_encode_picture_header(MPVMainEncContext *const m)
|
|||||||
w->abt_type = 0;
|
w->abt_type = 0;
|
||||||
w->j_type = 0;
|
w->j_type = 0;
|
||||||
|
|
||||||
av_assert0(s->c.flipflop_rounding);
|
av_assert0(s->flipflop_rounding);
|
||||||
|
|
||||||
if (s->c.pict_type == AV_PICTURE_TYPE_I) {
|
if (s->c.pict_type == AV_PICTURE_TYPE_I) {
|
||||||
av_assert0(s->c.no_rounding == 1);
|
av_assert0(s->c.no_rounding == 1);
|
||||||
|
Reference in New Issue
Block a user