image sampling format




image sampling format

    在对图片进行编解码时经常碰到S444, S422这些东西,这个是什么呢?就是image sampling format,又叫color sampling,wikimedia上又叫chroma subsampling。这个东西的由来是这样的。


    直接以RGB来编码一张图片,每一个象素都由RGB三个分量组成,一个3x3的图片就如下:

     RGB RGB RGB

     RGB RGB RGB

     RGB RGB RGB

    这就是S444(为什么是‘4’呢,后面再讲),

    这样有什么问题呢,浪费带宽,不低碳不环保。利用人的视觉系统对亮度比对颜色敏感这一特性,所以将RGB这种表示方法转为YCbCr这种方式(Y亮度, Cb blue, Cr red)。因为颜色不如亮度敏感,所以可以每隔一象素存一个颜色分量,这样就减少了带宽。

    YCbCr Y YCbCr Y

    YCbCr Y YCbCr Y 

    YCbCr Y YCbCr Y

    YCbCr Y YCbCr Y

    这是一张4x4大小的图片,这个图片的特点是,Y分量每个象素都有,而CbCr分量是每隔一个象素有一份,这就是S422,sampling format是这样一个表达式:J:a:b(比如这里的4:2:2),

    J:horizontal sampling reference (width of the conceptual region). Usually, 4(这样就明白了为什么UIC里面叫的ImageSamplingGeometry)

  a:number of chrominance samples (Cr, Cb) in the first row of J pixels

  b:number of (additional) chrominance samples (Cr, Cb) in the second row of J pixels.

  按照这个定义,我们就可以写出S420的样子:

  YCbCr Y YCbCr Y

  Y     Y   Y   Y

  YCbCr Y YCbCr Y

  Y     Y   Y   Y

你可能感兴趣的:(image sampling format)