diff options
Diffstat (limited to 'sharpyuv/sharpyuv.h')
-rw-r--r-- | sharpyuv/sharpyuv.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/sharpyuv/sharpyuv.h b/sharpyuv/sharpyuv.h index d0ef379f..70f9b998 100644 --- a/sharpyuv/sharpyuv.h +++ b/sharpyuv/sharpyuv.h @@ -35,15 +35,33 @@ typedef struct { // Assumes that the image will be upsampled using a bilinear filter. If nearest // neighbor is used instead, the upsampled image might look worse than with // standard downsampling. -// TODO(maryla): add 10 bits support. Add YUV444 to YUV420 conversion. -// Maybe also add 422 support (it's rarely used in practice, especially for -// images). -int SharpYuvConvert(const uint8_t* r_ptr, const uint8_t* g_ptr, - const uint8_t* b_ptr, int step, int rgb_stride, - uint8_t* dst_y, int dst_stride_y, uint8_t* dst_u, - int dst_stride_u, uint8_t* dst_v, int dst_stride_v, - int width, int height, - const SharpYuvConversionMatrix* yuv_matrix); +// r_ptr, g_ptr, b_ptr: pointers to the source r, g and b channels. Should point +// to uint8_t buffers if rgb_bit_depth is 8, or uint16_t buffers otherwise. +// rgb_step: distance in bytes between two horizontally adjacent pixels on the +// r, g and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_stride: distance in bytes between two vertically adjacent pixels on the +// r, g, and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_bit_depth: number of bits for each r/g/b value. One of: 8, 10, 12, 16. +// Note: for 10+ bit, input is truncated to 10 bits. +// TODO(b/194336375): increase precision. +// yuv_bit_depth: number of bits for each y/u/v value. One of: 8, 10, 12. +// y_ptr, u_ptr, v_ptr: pointers to the destination y, u and v channels. Should +// point to uint8_t buffers if yuv_bit_depth is 8, or uint16_t buffers +// otherwise. +// y_stride, u_stride, v_stride: distance in bytes between two vertically +// adjacent pixels on the y, u and v channels. If yuv_bit_depth > 8, they +// should be multiples of 2. +// width, height: width and height of the image in pixels +int SharpYuvConvert(const void* r_ptr, const void* g_ptr, const void* b_ptr, + int rgb_step, int rgb_stride, int rgb_bit_depth, + void* y_ptr, int y_stride, void* u_ptr, int u_stride, + void* v_ptr, int v_stride, int yuv_bit_depth, int width, + int height, const SharpYuvConversionMatrix* yuv_matrix); + +// TODO(b/194336375): Add YUV444 to YUV420 conversion. Maybe also add 422 +// support (it's rarely used in practice, especially for images). #ifdef __cplusplus } // extern "C" |