X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpegvideo.h;h=e16deb64e7eeb1257991b5ae205a73bd384f7e94;hb=d05c3b9ceeb9d00d4500c376448230e45f6ab108;hp=c5e3359458df7a03b8576d2ddffdc0939d322369;hpb=0a320f7e7a9bf8e6e9e9c33adfdb5bea743bfd52;p=ffmpeg diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index c5e3359458d..e16deb64e7e 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -45,6 +45,7 @@ #include "mpegpicture.h" #include "mpegvideodsp.h" #include "mpegvideoencdsp.h" +#include "mpegvideodata.h" #include "pixblockdsp.h" #include "put_bits.h" #include "ratecontrol.h" @@ -71,6 +72,8 @@ #define SLICE_MAX_START_CODE 0x000001af #define EXT_START_CODE 0x000001b5 #define USER_START_CODE 0x000001b2 +#define SLICE_START_CODE 0x000001b7 + /** * MpegEncContext. @@ -366,7 +369,7 @@ typedef struct MpegEncContext { uint8_t *mb_info_ptr; int mb_info_size; int ehc_mode; - int rc_strategy; + int rc_strategy; ///< deprecated /* H.263+ specific */ int umvplus; ///< == H.263+ && unrestricted_mv @@ -378,6 +381,8 @@ typedef struct MpegEncContext { int custom_pcf; /* MPEG-4 specific */ + int studio_profile; + int dct_precision; ///< number of bits to represent the fractional part of time (encoder only) int time_increment_bits; int last_time_base; @@ -464,6 +469,13 @@ typedef struct MpegEncContext { int intra_vlc_format; int alternate_scan; int seq_disp_ext; + int video_format; +#define VIDEO_FORMAT_COMPONENT 0 +#define VIDEO_FORMAT_PAL 1 +#define VIDEO_FORMAT_NTSC 2 +#define VIDEO_FORMAT_SECAM 3 +#define VIDEO_FORMAT_MAC 4 +#define VIDEO_FORMAT_UNSPECIFIED 5 int repeat_first_field; int chroma_420_type; int chroma_format; @@ -494,7 +506,10 @@ typedef struct MpegEncContext { int16_t (*block)[64]; ///< points to one of the following blocks int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block - int (*decode_mb)(struct MpegEncContext *s, int16_t block[6][64]); // used by some codecs to avoid a switch() + int (*decode_mb)(struct MpegEncContext *s, int16_t block[12][64]); // used by some codecs to avoid a switch() + + int32_t (*block32)[12][64]; + #define SLICE_OK 0 #define SLICE_ERROR -1 #define SLICE_END -2 ///> s->avctx->lowres; + const int bytes_per_pixel = 1 + (s->avctx->bits_per_raw_sample > 8); + const int block_size= (8*bytes_per_pixel) >> s->avctx->lowres; s->block_index[0]+=2; s->block_index[1]+=2; @@ -731,8 +741,8 @@ static inline void ff_update_block_index(MpegEncContext *s){ s->block_index[4]++; s->block_index[5]++; s->dest[0]+= 2*block_size; - s->dest[1]+= block_size; - s->dest[2]+= block_size; + s->dest[1]+= (2 >> s->chroma_x_shift) * block_size; + s->dest[2]+= (2 >> s->chroma_x_shift) * block_size; } static inline int get_bits_diff(MpegEncContext *s){ @@ -744,4 +754,13 @@ static inline int get_bits_diff(MpegEncContext *s){ return bits - last; } +static inline int mpeg_get_qscale(MpegEncContext *s) +{ + int qscale = get_bits(&s->gb, 5); + if (s->q_scale_type) + return ff_mpeg2_non_linear_qscale[qscale]; + else + return qscale << 1; +} + #endif /* AVCODEC_MPEGVIDEO_H */