[FFmpeg-devel] New pixel format uyvy422i12le

Fu, Linjie linjie.fu at intel.com
Mon Mar 9 12:06:17 EET 2020


> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Damien Chabannes
> Sent: Monday, March 9, 2020 17:05
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] New pixel format uyvy422i12le
> 
> Hi everyone,
> 
> I'm trying to implement a new pixel format in FFmpeg but it appears that my
> implementation is not correct. Indeed, when I do a ffplay on a raw video in
> this new pixel format, the output is not correct.
> 
> The pixel format I want to implement is the uyvy422i12le. Data y, u and v
> are stored in the same buffer, in this interlaced way : u0, y0, v0, y1, u1,
> y2, v1, y3, u2, y4, v2, y5, ..., each data is encoded on 12 bits and stored
> on 16 bits Little Endian.
> 
> For adding this new pix_fmt, I have done the following modifications :
> 
>    - in libavutil/pixfmt.h, add "AV_PIX_FMT_UYVY422I12LE" in enum
>    AVPixelFormat
> 
> 
>    - in libavutil/pixdesc.c, add AV_PIX_FMT_UYVY422I12LE in
>    av_pix_fmt_descriptors :
> 
>     [AV_PIX_FMT_UYVY422I12LE] = {
>         .name = "uyvy422i12le",
>         .nb_components = 3,
>         .log2_chroma_w = 1,
>         .log2_chroma_h = 0,
>         .comp = {
>             { 0, 4, 2, 0, 12, 3, 11, 3 },        /* Y */
>             { 0, 8, 0, 0, 12, 7, 11, 1 },        /* U */
>             { 0, 8, 4, 0, 12, 7, 11, 5 },        /* V */
> 
>    - in libswscale/utils.c, add "[AV_PIX_FMT_UYVY422I12LE]= { 1, 1 }," in
>    format_entries

With this format entry declared for your format, you are supposed to implement input and
output function support in swscale. Otherwise it may fallback to other existed functions to
do color space conversion. (Perhaps it may be the reason for your garbage)

- Linjie


More information about the ffmpeg-devel mailing list