Add an initializer for the SharpYuvOptions struct.

Change-Id: I36510bc361b040d3d3e7d261ab67b24ffc3013a6
This commit is contained in:
Vincent Rabaud
2023-06-29 15:58:30 +02:00
parent 4222b00679
commit e2c85878f6
2 changed files with 46 additions and 2 deletions

View File

@ -483,6 +483,21 @@ int SharpYuvConvert(const void* r_ptr, const void* g_ptr, const void* b_ptr,
u_ptr, u_stride, v_ptr, v_stride, yuv_bit_depth, width, height, &options);
}
int SharpYuvOptionsInitInternal(const SharpYuvConversionMatrix* yuv_matrix,
SharpYuvOptions* options, int version) {
const int major = (version >> 24);
const int minor = (version >> 16) & 0xff;
if (options == NULL || yuv_matrix == NULL ||
(major == SHARPYUV_VERSION_MAJOR && major == 0 &&
minor != SHARPYUV_VERSION_MINOR) ||
(major != SHARPYUV_VERSION_MAJOR)) {
return 0;
}
options->yuv_matrix = yuv_matrix;
options->transfer_type = kSharpYuvTransferFunctionSrgb;
return 1;
}
int SharpYuvConvertWithOptions(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,