Here are some notes on how to integrate YCbCr into pixman:

       for each destination pixel
           s = location in source

           find nearest luma sample 

           align midpoint of convolution kernel with that sample

           for each pixel in convolution kernel,           
               find nearest luma sample, apply weight, add to sum
               find nearest chroma sample, apply weight, add to sum
           
           apply the color matrix.

         pixman_image_create_bits (format, char **planes, int **rowstrides);

Proposed API:

typedef enum
{
    PIXMAN_COLOR_MATRIX_NONE,
    PIXMAN_COLOR_MATRIX_HD,
    PIXMAN_COLOR_MATRIX_SD,
    PIXMAN_COLOR_MATRIX_JPEG
} pixman_color_matrix_t:

/* - Default is MATRIX_NONE.
 * - If you set a YCrCb format, then you should also set
 *   a matrix, or things will not make sense
 */
void
pixman_image_set_color_matrix (pixman_image_t        *image,
                               pixman_color_matrix_t  matrix);

/* 'jpeg' means half-sited chroma positions
 *  'mpeg2' means co-sited positions
 */
typedef enum
{
    PIXMAN_420_planar_jpeg,
    PIXMAN_420_planar_mpeg2,
    PIXMAN_nv12_planar_jpeg,
    PIXMAN_nv21_planar_mpeg2,
    PIXMAN_yvyu_packed_jpeg,
    PIXMAN_yvyu_packed_mpeg2,
    PIXMAN_yuyv_packed_jpeg,
    PIXMAN_yuyv_packed_mpeg2,

    PIXMAN_y444,
} pixman_format_t;

VideoHackfest/pixman (last edited 2009-11-22 13:13:50 by 74)