[FFmpeg-devel] [PATCH] libavformat/yuv4mpeg: Add color range support for Y4M Add color_range support in Y4M. Also set pixel format and color_range for YUVJ pixel formats.

Michael Niedermayer michael at niedermayer.cc
Tue Jun 26 02:37:26 EEST 2018


On Thu, Jun 14, 2018 at 12:03:13AM +0800, Wang Cao wrote:
> ---
>  libavformat/yuv4mpegdec.c |  8 ++++++++
>  libavformat/yuv4mpegenc.c | 37 +++++++++++++++++++++++++++++++++++--
>  2 files changed, 43 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
> index eff7fc518e..86e8673b2f 100644
> --- a/libavformat/yuv4mpegdec.c
> +++ b/libavformat/yuv4mpegdec.c
> @@ -41,6 +41,7 @@ static int yuv4_read_header(AVFormatContext *s)
>      enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE;
>      enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
>      enum AVFieldOrder field_order = AV_FIELD_UNKNOWN;
> +    enum AVColorRange color_range = AVCOL_RANGE_UNSPECIFIED;
>      AVStream *st;
>  
>      for (i = 0; i < MAX_YUV4_HEADER; i++) {
> @@ -220,6 +221,12 @@ static int yuv4_read_header(AVFormatContext *s)
>                      alt_pix_fmt = AV_PIX_FMT_YUV422P;
>                  else if (strncmp("444", tokstart, 3) == 0)
>                      alt_pix_fmt = AV_PIX_FMT_YUV444P;
> +            } else if (strncmp("COLORRANGE=", tokstart, 11) == 0) {
> +              tokstart += 11;
> +              if (strncmp("JPEG",tokstart, 4) == 0)
> +                  color_range = AVCOL_RANGE_JPEG;
> +              else if (strncmp("MPEG", tokstart, 4) == 0)
> +                  color_range = AVCOL_RANGE_MPEG;
>              }

If this is a type we are choosing then it would be probably better
to use something else than mpeg/jpeg as names
these are 2 standard comittees and their standards support more than
one color range.

maybe "full" and "limited" or some other terms may be better

thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180626/1dd07f1b/attachment.sig>


More information about the ffmpeg-devel mailing list