[FFmpeg-trac] #3242(swscale:new): libswscale incorrectly presents warning about "Deprecated pixel format"

FFmpeg trac at avcodec.org
Tue Dec 24 22:46:16 CET 2013


#3242: libswscale incorrectly presents warning about "Deprecated pixel format"
---------------------------------+---------------------------------------
             Reporter:  jnvsor   |                     Type:  defect
               Status:  new      |                 Priority:  minor
            Component:  swscale  |                  Version:  unspecified
             Keywords:           |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+---------------------------------------
 libswscale incorrectly presents warning about "Deprecated pixel format" on
 padded rgb pixel formats

 `#ffmpeg-devel` leads me to believe BGR0 isn't deprecated so this is a bug

 `sws_init_context` gives a warning if `c->srcFormat` changes from the
 start of the function, before that if statement however it calls:
 `sws_setColorspaceDetails` which calls
 `handle_formats` which calls
 `handle_0alpha` which changes the pixel formats and triggers the warning

 {{{
 av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
                              SwsFilter *dstFilter)
 {
     ...

     if (!c->contrast && !c->saturation && !c->dstFormatBpp)
         sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
 c->srcRange,
                                  ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
                                  c->dstRange, 0, 1 << 16, 1 << 16);

     if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat)
         av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure
 you did set range correctly\n");
     ...
 }

 int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
                              int srcRange, const int table[4], int
 dstRange,
                              int brightness, int contrast, int saturation)
 {
     const AVPixFmtDescriptor *desc_dst;
     const AVPixFmtDescriptor *desc_src;
     memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
     memmove(c->dstColorspaceTable, table, sizeof(int) * 4);

     handle_formats(c);
     ...
 }

 static void handle_formats(SwsContext *c)
 {
     c->src0Alpha |= handle_0alpha(&c->srcFormat);
     c->dst0Alpha |= handle_0alpha(&c->dstFormat);
     c->srcXYZ    |= handle_xyz(&c->srcFormat);
     c->dstXYZ    |= handle_xyz(&c->dstFormat);
     if (c->srcXYZ || c->dstXYZ)
         fill_xyztables(c);
 }

 static int handle_0alpha(enum AVPixelFormat *format)
 {
     switch (*format) {
     case AV_PIX_FMT_0BGR    : *format = AV_PIX_FMT_ABGR   ; return 1;
     case AV_PIX_FMT_BGR0    : *format = AV_PIX_FMT_BGRA   ; return 4;
     case AV_PIX_FMT_0RGB    : *format = AV_PIX_FMT_ARGB   ; return 1;
     case AV_PIX_FMT_RGB0    : *format = AV_PIX_FMT_RGBA   ; return 4;
     default:                                          return 0;
     }
 }
 }}}


 Reproduce:

 {{{
 # the only bgr0 pixel format I know of is x11grab but any rgb padded input
 should do it
 ffmpeg -f x11grab -i :0.0 -filter:v "scale=w=0:h=0" -c:v libx264 -pix_fmt
 yuv444p out.avi
 ...
 [x11grab @ 0xd0cd80] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 640
 height: 480
 [x11grab @ 0xd0cd80] shared memory extension found
 Input #0, x11grab, from ':0.0':
   Duration: N/A, start: 1387920952.573846, bitrate: 294617 kb/s
     Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 640x480,
 294617 kb/s, 29.97 tbr, 1000k tbn, 29.97 tbc
 File 'out.avi' already exists. Overwrite ? [y/N] y
 [swscaler @ 0xcfd020] deprecated pixel format used, make sure you did set
 range correctly
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3242>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list