[FFmpeg-trac] #3785(swscale:new): SWSCALE: in_range, in_color_matrix, out_range, out_color_matrix incorrect

FFmpeg trac at avcodec.org
Sat Jul 19 21:20:18 CEST 2014

#3785: SWSCALE: in_range, in_color_matrix, out_range, out_color_matrix incorrect
             Reporter:  troy_s      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  swscale
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |

Comment (by troy_s):

 Analysing the resultant output image as a raw RGB image for statistical
 purposes, based on a simple renaming of the planar file to avoid YUV
 conversion in ImageMagick:
 aphorism at u64x6:~/Develop/ffmpeg$ identify -verbose  -size 1920x1080 -depth
 8 -interlace plane rgb:./out.raw
 Image: ./out.raw
   Base filename: out.raw
   Format: RGB (Raw red, green, and blue samples)
   Class: DirectClass
   Geometry: 1920x1080+0+0
   Resolution: 72x72
   Print size: 26.6667x15
   Units: Undefined
   Type: TrueColor
   Endianess: LSB
   Colorspace: sRGB
   Depth: 8-bit
   Channel depth:
     red: 8-bit
     green: 8-bit
     blue: 8-bit
   Channel statistics:
       min: 16 (0.0627451)
       max: 235 (0.921569)
       mean: 104.958 (0.411601)
       standard deviation: 72.5761 (0.284612)
       kurtosis: -1.32201
       skewness: 0.447203
       min: 32 (0.12549)
       max: 240 (0.941176)
       mean: 130.152 (0.510402)
       standard deviation: 37.936 (0.148768)
       kurtosis: 0.516604
       skewness: 0.17742
       min: 0 (0)
       max: 255 (1)
       mean: 1.00469 (0.00393995)
       standard deviation: 12.6817 (0.0497322)
       kurtosis: 251.198
       skewness: 15.0671
   Image statistics:
       min: 0 (0)
       max: 255 (1)
       mean: 78.7052 (0.308648)
       standard deviation: 47.8444 (0.187625)
       kurtosis: 7.50915
       skewness: 1.50966

 Assuming the above command generates raw YCbCr in agreement with our
 estimations, a few things pop out:
 1. The luma (Y' == R channel here) is still in broadcast range.
 1. The Cb is odd. Given that we have a blue gradient going from 0-255, as
 well as pure white and pure black swatches, we should expect a full range
 of Cb along the yellow / blue axis. Instead, we are seeing something that
 looks very close to broadcast range (16-240 8 bit) with a doubled up
 offset to 32.
 1. The Cr is delivering correct range levels at a cursory glance of the
 distribution numbers.

Ticket URL: <https://trac.ffmpeg.org/ticket/3785#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list