[FFmpeg-cvslog] r18795 - in trunk/libavcodec: avcodec.h dv.c h263dec.c h264.c mjpegdec.c mpeg12.c options.c vp3.c
conrad
subversion
Mon May 11 06:34:23 CEST 2009
Author: conrad
Date: Mon May 11 06:34:23 2009
New Revision: 18795
Log:
Add a chroma_sample_location field to define positioning of chroma samples
Modified:
trunk/libavcodec/avcodec.h
trunk/libavcodec/dv.c
trunk/libavcodec/h263dec.c
trunk/libavcodec/h264.c
trunk/libavcodec/mjpegdec.c
trunk/libavcodec/mpeg12.c
trunk/libavcodec/options.c
trunk/libavcodec/vp3.c
Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/avcodec.h Mon May 11 06:34:23 2009 (r18795)
@@ -479,6 +479,22 @@ enum AVColorRange{
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{
int start_frame;
int end_frame;
@@ -2481,6 +2497,13 @@ typedef struct AVCodecContext {
* - decoding: Set by libavcodec
*/
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;
/**
Modified: trunk/libavcodec/dv.c
==============================================================================
--- trunk/libavcodec/dv.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/dv.c Mon May 11 06:34:23 2009 (r18795)
@@ -393,6 +393,7 @@ static av_cold int dvvideo_init(AVCodecC
avctx->coded_frame = &s->picture;
s->avctx = avctx;
+ avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
return 0;
}
Modified: trunk/libavcodec/h263dec.c
==============================================================================
--- trunk/libavcodec/h263dec.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/h263dec.c Mon May 11 06:34:23 2009 (r18795)
@@ -59,12 +59,14 @@ av_cold int ff_h263_decode_init(AVCodecC
switch(avctx->codec->id) {
case CODEC_ID_H263:
s->unrestricted_mv= 0;
+ avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
break;
case CODEC_ID_MPEG4:
s->decode_mb= ff_mpeg4_decode_mb;
s->time_increment_bits = 4; /* default value for broken headers */
s->h263_pred = 1;
s->low_delay = 0; //default, might be overriden in the vol header during header parsing
+ avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
break;
case CODEC_ID_MSMPEG4V1:
s->h263_msmpeg4 = 1;
@@ -96,6 +98,7 @@ av_cold int ff_h263_decode_init(AVCodecC
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
s->msmpeg4_version=6;
+ avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
break;
case CODEC_ID_H263I:
break;
Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/h264.c Mon May 11 06:34:23 2009 (r18795)
@@ -2198,6 +2198,7 @@ static av_cold int decode_init(AVCodecCo
else
avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
+ avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
decode_init_vlc();
@@ -7064,7 +7065,7 @@ static inline int decode_vui_parameters(
}
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 */
}
Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/mjpegdec.c Mon May 11 06:34:23 2009 (r18795)
@@ -85,6 +85,7 @@ av_cold int ff_mjpeg_decode_init(AVCodec
s->start_code = -1;
s->first_picture = 1;
s->org_height = avctx->coded_height;
+ avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
build_basic_mjpeg_vlc(s);
Modified: trunk/libavcodec/mpeg12.c
==============================================================================
--- trunk/libavcodec/mpeg12.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/mpeg12.c Mon May 11 06:34:23 2009 (r18795)
@@ -1189,6 +1189,10 @@ static av_cold int mpeg_decode_init(AVCo
s->repeat_field = 0;
s->mpeg_enc_ctx.codec_id= avctx->codec->id;
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;
}
Modified: trunk/libavcodec/options.c
==============================================================================
--- trunk/libavcodec/options.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/options.c Mon May 11 06:34:23 2009 (r18795)
@@ -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},
{"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},
+{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, AVCHROMA_LOC_UNSPECIFIED, 0, AVCHROMA_LOC_NB-1, V|E|D},
{NULL},
};
Modified: trunk/libavcodec/vp3.c
==============================================================================
--- trunk/libavcodec/vp3.c Mon May 11 04:41:50 2009 (r18794)
+++ trunk/libavcodec/vp3.c Mon May 11 06:34:23 2009 (r18795)
@@ -1639,6 +1639,7 @@ static av_cold int vp3_decode_init(AVCod
s->width = (avctx->width + 15) & 0xFFFFFFF0;
s->height = (avctx->height + 15) & 0xFFFFFFF0;
avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
if(avctx->idct_algo==FF_IDCT_AUTO)
avctx->idct_algo=FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx);
More information about the ffmpeg-cvslog
mailing list