Originally committed as revision 18795 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.6
| @@ -479,6 +479,22 @@ enum AVColorRange{ | |||||
| AVCOL_RANGE_NB , ///< Not part of ABI | AVCOL_RANGE_NB , ///< Not part of ABI | ||||
| }; | }; | ||||
| /** | |||||
| * X X 3 4 X X are luma samples, | |||||
| * 1 2 1-6 are possible chroma positions | |||||
| * X X 5 6 X 0 is undefined/unknown position | |||||
| */ | |||||
| enum AVChromaLocation{ | |||||
| AVCHROMA_LOC_UNSPECIFIED=0, | |||||
| AVCHROMA_LOC_LEFT =1, ///< mpeg2/4, h264 default | |||||
| AVCHROMA_LOC_CENTER =2, ///< mpeg1, jpeg, h263 | |||||
| AVCHROMA_LOC_TOPLEFT =3, ///< DV | |||||
| AVCHROMA_LOC_TOP =4, | |||||
| AVCHROMA_LOC_BOTTOMLEFT =5, | |||||
| AVCHROMA_LOC_BOTTOM =6, | |||||
| AVCHROMA_LOC_NB , ///< Not part of ABI | |||||
| }; | |||||
| typedef struct RcOverride{ | typedef struct RcOverride{ | ||||
| int start_frame; | int start_frame; | ||||
| int end_frame; | int end_frame; | ||||
| @@ -2481,6 +2497,13 @@ typedef struct AVCodecContext { | |||||
| * - decoding: Set by libavcodec | * - decoding: Set by libavcodec | ||||
| */ | */ | ||||
| enum AVColorRange color_range; | enum AVColorRange color_range; | ||||
| /** | |||||
| * This defines the location of chroma samples. | |||||
| * - encoding: Set by user | |||||
| * - decoding: Set by libavcodec | |||||
| */ | |||||
| enum AVChromaLocation chroma_sample_location; | |||||
| } AVCodecContext; | } AVCodecContext; | ||||
| /** | /** | ||||
| @@ -393,6 +393,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx) | |||||
| avctx->coded_frame = &s->picture; | avctx->coded_frame = &s->picture; | ||||
| s->avctx = avctx; | s->avctx = avctx; | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -59,12 +59,14 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) | |||||
| switch(avctx->codec->id) { | switch(avctx->codec->id) { | ||||
| case CODEC_ID_H263: | case CODEC_ID_H263: | ||||
| s->unrestricted_mv= 0; | s->unrestricted_mv= 0; | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; | |||||
| break; | break; | ||||
| case CODEC_ID_MPEG4: | case CODEC_ID_MPEG4: | ||||
| s->decode_mb= ff_mpeg4_decode_mb; | s->decode_mb= ff_mpeg4_decode_mb; | ||||
| s->time_increment_bits = 4; /* default value for broken headers */ | s->time_increment_bits = 4; /* default value for broken headers */ | ||||
| s->h263_pred = 1; | s->h263_pred = 1; | ||||
| s->low_delay = 0; //default, might be overriden in the vol header during header parsing | s->low_delay = 0; //default, might be overriden in the vol header during header parsing | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; | |||||
| break; | break; | ||||
| case CODEC_ID_MSMPEG4V1: | case CODEC_ID_MSMPEG4V1: | ||||
| s->h263_msmpeg4 = 1; | s->h263_msmpeg4 = 1; | ||||
| @@ -96,6 +98,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) | |||||
| s->h263_msmpeg4 = 1; | s->h263_msmpeg4 = 1; | ||||
| s->h263_pred = 1; | s->h263_pred = 1; | ||||
| s->msmpeg4_version=6; | s->msmpeg4_version=6; | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; | |||||
| break; | break; | ||||
| case CODEC_ID_H263I: | case CODEC_ID_H263I: | ||||
| break; | break; | ||||
| @@ -2198,6 +2198,7 @@ static av_cold int decode_init(AVCodecContext *avctx){ | |||||
| else | else | ||||
| avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts); | avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts); | ||||
| avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); | avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; | |||||
| decode_init_vlc(); | decode_init_vlc(); | ||||
| @@ -7064,7 +7065,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ | |||||
| } | } | ||||
| if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */ | if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */ | ||||
| get_ue_golomb(&s->gb); /* chroma_sample_location_type_top_field */ | |||||
| s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_sample_location_type_top_field */ | |||||
| get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */ | get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */ | ||||
| } | } | ||||
| @@ -85,6 +85,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) | |||||
| s->start_code = -1; | s->start_code = -1; | ||||
| s->first_picture = 1; | s->first_picture = 1; | ||||
| s->org_height = avctx->coded_height; | s->org_height = avctx->coded_height; | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; | |||||
| build_basic_mjpeg_vlc(s); | build_basic_mjpeg_vlc(s); | ||||
| @@ -1189,6 +1189,10 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) | |||||
| s->repeat_field = 0; | s->repeat_field = 0; | ||||
| s->mpeg_enc_ctx.codec_id= avctx->codec->id; | s->mpeg_enc_ctx.codec_id= avctx->codec->id; | ||||
| avctx->color_range= AVCOL_RANGE_MPEG; | avctx->color_range= AVCOL_RANGE_MPEG; | ||||
| if (avctx->codec->id == CODEC_ID_MPEG1VIDEO) | |||||
| avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; | |||||
| else | |||||
| avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -398,6 +398,7 @@ static const AVOption options[]={ | |||||
| {"color_trc", NULL, OFFSET(color_trc), FF_OPT_TYPE_INT, AVCOL_TRC_UNSPECIFIED, 1, AVCOL_TRC_NB-1, V|E|D}, | {"color_trc", NULL, OFFSET(color_trc), FF_OPT_TYPE_INT, AVCOL_TRC_UNSPECIFIED, 1, AVCOL_TRC_NB-1, V|E|D}, | ||||
| {"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, AVCOL_SPC_UNSPECIFIED, 1, AVCOL_SPC_NB-1, V|E|D}, | {"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, AVCOL_SPC_UNSPECIFIED, 1, AVCOL_SPC_NB-1, V|E|D}, | ||||
| {"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, AVCOL_RANGE_UNSPECIFIED, 0, AVCOL_RANGE_NB-1, V|E|D}, | {"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, AVCOL_RANGE_UNSPECIFIED, 0, AVCOL_RANGE_NB-1, V|E|D}, | ||||
| {"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, AVCHROMA_LOC_UNSPECIFIED, 0, AVCHROMA_LOC_NB-1, V|E|D}, | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| @@ -1639,6 +1639,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) | |||||
| s->width = (avctx->width + 15) & 0xFFFFFFF0; | s->width = (avctx->width + 15) & 0xFFFFFFF0; | ||||
| s->height = (avctx->height + 15) & 0xFFFFFFF0; | s->height = (avctx->height + 15) & 0xFFFFFFF0; | ||||
| avctx->pix_fmt = PIX_FMT_YUV420P; | avctx->pix_fmt = PIX_FMT_YUV420P; | ||||
| avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; | |||||
| if(avctx->idct_algo==FF_IDCT_AUTO) | if(avctx->idct_algo==FF_IDCT_AUTO) | ||||
| avctx->idct_algo=FF_IDCT_VP3; | avctx->idct_algo=FF_IDCT_VP3; | ||||
| dsputil_init(&s->dsp, avctx); | dsputil_init(&s->dsp, avctx); | ||||