X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpeg12enc.c;h=6f87117058984fe2480518f2975230e12e37e436;hb=9dc30d08114068ccfe65e89c3c46deee3e6a2289;hp=d131e48285028b8ccbf7718b98b076e25fa9896a;hpb=bb619f41bea81e6ee9e208476a92fced4107a853;p=ffmpeg diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index d131e482850..6f871170589 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -42,9 +42,10 @@ #include "mpegutils.h" #include "mpegvideo.h" - -static const uint8_t inv_non_linear_qscale[] = { +static const int8_t inv_non_linear_qscale[] = { 0, 2, 4, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, + -1,17,-1,18,-1,19, -1, 20, -1, 21, -1, 22, -1, + 23,-1,24,-1,-1,-1 }; static const uint8_t svcd_scan_offset_placeholder[] = { @@ -205,7 +206,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } } - s->drop_frame_timecode = s->drop_frame_timecode || !!(avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE); + s->drop_frame_timecode = s->drop_frame_timecode || !!(avctx->flags2 & AV_CODEC_FLAG2_DROP_FRAME_TIMECODE); if (s->drop_frame_timecode) s->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME; if (s->drop_frame_timecode && s->frame_rate_index != 4) { @@ -384,7 +385,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_bits(&s->pb, 1, 1); put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60)); put_bits(&s->pb, 6, (uint32_t)((time_code % fps))); - put_bits(&s->pb, 1, !!(s->avctx->flags & CODEC_FLAG_CLOSED_GOP) || s->intra_only || !s->gop_picture_number); + put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || s->intra_only || !s->gop_picture_number); put_bits(&s->pb, 1, 0); // broken link } } @@ -402,8 +403,9 @@ static inline void encode_mb_skip_run(MpegEncContext *s, int run) static av_always_inline void put_qscale(MpegEncContext *s) { if (s->q_scale_type) { - av_assert2(s->qscale >= 1 && s->qscale <= 12); - put_bits(&s->pb, 5, inv_non_linear_qscale[s->qscale]); + int qp = inv_non_linear_qscale[s->qscale]; + av_assert2(s->qscale >= 1 && qp > 0); + put_bits(&s->pb, 5, qp); } else { put_bits(&s->pb, 5, s->qscale); } @@ -1155,7 +1157,7 @@ AVCodec ff_mpeg1video_encoder = { .supported_framerates = ff_mpeg12_frame_rate_tab + 1, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, - .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .priv_class = &mpeg1_class, }; @@ -1172,6 +1174,6 @@ AVCodec ff_mpeg2video_encoder = { .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE }, - .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .priv_class = &mpeg2_class, };