On Saturday 09 May 2015 11:53:13 am wm4 wrote: > On Sat, 9 May 2015 11:12:46 +0200 > > Carl Eugen Hoyos <ceho...@ag.or.at> wrote: > > diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c > > index c47f5b1..162c295 100644 > > --- a/libavcodec/h263dec.c > > +++ b/libavcodec/h263dec.c > > @@ -48,8 +48,10 @@ static enum AVPixelFormat > > h263_get_format(AVCodecContext *avctx) if (avctx->codec->id == > > AV_CODEC_ID_MSS2) > > return AV_PIX_FMT_YUV420P; > > > > - if (CONFIG_GRAY && (avctx->flags & CODEC_FLAG_GRAY)) > > + if (CONFIG_GRAY && (avctx->flags & CODEC_FLAG_GRAY)) { > > + avctx->color_range = AVCOL_RANGE_MPEG; > > return AV_PIX_FMT_GRAY8; > > + } > > > > return avctx->pix_fmt = ff_get_format(avctx, > > avctx->codec->pix_fmts); } > > Are you sure this doesn't overwrite color_range values read from the > file? (I didn't check, but please make sure.)
asp and friends do not set the colour range but the user could, new patch attached, thank you! > It appears to me that making GRAY full range by default wasn't such a > good idea. I tend to disagree. > Also, this patch is libswscale specific Isn't that what I said when we discussed the commit message of your patch and you disagreed? > - unless you document somewhere that GRAY is in fact not just > like the Y plane of normal YUV formats, but is full range by default. This wouldn't be correct: pix_fmt gray can be both full range or mpeg range, I just believe that if nothing is set, libswscale should assume full range (it has to assume something). So far you have neither given an example of a "codec" for which this is different (I have, but I hope you agree these are very uncommon usecases) nor an example of a usecase for which FFmpeg can know the range and it should not be full range. > The API is inconsistent and undocumented in this aspect. Feel free to let libswscale print a warning if no scale was set. Carl Eugen
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index c47f5b1..3e115eb 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -48,8 +48,11 @@ static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) if (avctx->codec->id == AV_CODEC_ID_MSS2) return AV_PIX_FMT_YUV420P; - if (CONFIG_GRAY && (avctx->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (avctx->flags & CODEC_FLAG_GRAY)) { + if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) + avctx->color_range = AVCOL_RANGE_MPEG; return AV_PIX_FMT_GRAY8; + } return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); }
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel