#include <stdint.h>
typedef void (*yuv2rgb_fn)(int16_t *rgb[3], ptrdiff_t rgb_stride,
- uint8_t *yuv[3], ptrdiff_t yuv_stride[3],
+ uint8_t *yuv[3], const ptrdiff_t yuv_stride[3],
int w, int h, const int16_t yuv2rgb_coeffs[3][3][8],
const int16_t yuv_offset[8]);
-typedef void (*rgb2yuv_fn)(uint8_t *yuv[3], ptrdiff_t yuv_stride[3],
+typedef void (*rgb2yuv_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3],
int16_t *rgb[3], ptrdiff_t rgb_stride,
int w, int h, const int16_t rgb2yuv_coeffs[3][3][8],
const int16_t yuv_offset[8]);
-typedef void (*yuv2yuv_fn)(uint8_t *yuv_out[3], ptrdiff_t yuv_out_stride[3],
- uint8_t *yuv_in[3], ptrdiff_t yuv_in_stride[3],
+typedef void (*rgb2yuv_fsb_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3],
+ int16_t *rgb[3], ptrdiff_t rgb_stride,
+ int w, int h, const int16_t rgb2yuv_coeffs[3][3][8],
+ const int16_t yuv_offset[8],
+ int *rnd[3][2]);
+typedef void (*yuv2yuv_fn)(uint8_t *yuv_out[3], const ptrdiff_t yuv_out_stride[3],
+ uint8_t *yuv_in[3], const ptrdiff_t yuv_in_stride[3],
int w, int h, const int16_t yuv2yuv_coeffs[3][3][8],
const int16_t yuv_offset[2][8]);
+enum BitDepthIndex {
+ BPP_8,
+ BPP_10,
+ BPP_12,
+ NB_BPP,
+};
+
+enum ChromaSubsamplingIndex {
+ SS_444,
+ SS_422,
+ SS_420,
+ NB_SS,
+};
+
typedef struct ColorSpaceDSPContext {
- yuv2rgb_fn yuv2rgb[3 /* 0: 8bit, 1: 10bit, 2: 12bit */][3 /* 0: 444, 1: 422, 2: 420 */];
- rgb2yuv_fn rgb2yuv[3 /* 0: 8bit, 1: 10bit, 2: 12bit */][3 /* 0: 444, 1: 422, 2: 420 */];
- yuv2yuv_fn yuv2yuv[3 /* in_depth */][3 /* out_depth */][3 /* 0: 444, 1: 422, 2: 420 */];
+ /* Convert input YUV pixel buffer from a user into an internal, 15bpp array
+ * of intermediate RGB data. */
+ yuv2rgb_fn yuv2rgb[NB_BPP][NB_SS];
+ /* Convert intermediate RGB data (15bpp, internal format) into YUV data and
+ * store into user-provided output buffer */
+ rgb2yuv_fn rgb2yuv[NB_BPP][NB_SS];
+ /* Same as rgb2yuv(), but use floyd-steinberg dithering */
+ rgb2yuv_fsb_fn rgb2yuv_fsb[NB_BPP][NB_SS];
+ /* Direct yuv-to-yuv conversion (input and output are both user-provided
+ * buffers) */
+ yuv2yuv_fn yuv2yuv[NB_BPP /* in */][NB_BPP /* out */][NB_SS];
+ /* In-place 3x3 matrix multiplication. Input and output are both 15bpp
+ * (our internal data format) */
void (*multiply3x3)(int16_t *data[3], ptrdiff_t stride,
int w, int h, const int16_t m[3][3][8]);
} ColorSpaceDSPContext;