X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpeg12enc.c;h=350fa4016bcb48b743295a587cae0649584332d1;hb=af818f7a6612e70320f83c7ef0ddc9bfd035d18b;hp=6ef7e1ba7591348888ae85755f3844370052a4d1;hpb=6647ab80e36aa2484a145029141984843958b246;p=ffmpeg diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 6ef7e1ba759..350fa4016bc 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -1,6 +1,6 @@ /* * MPEG1/2 encoder - * Copyright (c) 2000,2001 Fabrice Bellard. + * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * * This file is part of FFmpeg. @@ -21,7 +21,7 @@ */ /** - * @file mpeg12enc.c + * @file libavcodec/mpeg12enc.c * MPEG1/2 encoder */ @@ -327,7 +327,12 @@ static av_always_inline void put_qscale(MpegEncContext *s) } void ff_mpeg1_encode_slice_header(MpegEncContext *s){ - put_header(s, SLICE_MIN_START_CODE + s->mb_y); + if (s->height > 2800) { + put_header(s, SLICE_MIN_START_CODE + (s->mb_y & 127)); + put_bits(&s->pb, 3, s->mb_y >> 7); /* slice_vertical_position_extension */ + } else { + put_header(s, SLICE_MIN_START_CODE + s->mb_y); + } put_qscale(s); put_bits(&s->pb, 1, 0); /* slice extra information */ } @@ -666,19 +671,17 @@ void mpeg1_encode_mb(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int // RAL: Parameter added: f_or_b_code static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) { - int code, bit_size, l, bits, range, sign; - if (val == 0) { /* zero vector */ - code = 0; put_bits(&s->pb, ff_mpeg12_mbMotionVectorTable[0][1], ff_mpeg12_mbMotionVectorTable[0][0]); } else { - bit_size = f_or_b_code - 1; - range = 1 << bit_size; + int code, sign, bits; + int bit_size = f_or_b_code - 1; + int range = 1 << bit_size; /* modulo encoding */ - l= INT_BIT - 5 - bit_size; + int l= INT_BIT - 5 - bit_size; val= (val<>l; if (val >= 0) { @@ -936,7 +939,7 @@ AVCodec mpeg1video_encoder = { MPV_encode_picture, MPV_encode_end, .supported_framerates= ff_frame_rate_tab+1, - .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, + .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .capabilities= CODEC_CAP_DELAY, .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"), }; @@ -950,7 +953,7 @@ AVCodec mpeg2video_encoder = { MPV_encode_picture, MPV_encode_end, .supported_framerates= ff_frame_rate_tab+1, - .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}, + .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}, .capabilities= CODEC_CAP_DELAY, .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"), };