Skip to content

Commit 7bd8cce

Browse files
committed
Add back convert_yuv_to_planarrgb_float_c body
1 parent effa137 commit 7bd8cce

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

avs_core/convert/convert_planar.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,14 +953,26 @@ static void convert_yuv_to_planarrgb_uintN_c(BYTE* dstp[3], int dstPitch[3], con
953953

954954
static void convert_yuv_to_planarrgb_float_c(BYTE* dstp[3], int dstPitch[3], const BYTE* srcp[3], const int srcPitch[3], int width, int height, const ConversionMatrix& matrix) {
955955
for (int y = 0; y < height; y++) {
956+
const float* srcY = reinterpret_cast<const float*>(srcp[0]);
957+
const float* srcU = reinterpret_cast<const float*>(srcp[1]);
958+
const float* srcV = reinterpret_cast<const float*>(srcp[2]);
959+
// We use auto here to handle either float* or pixel_t* destinations
960+
float* d0 = reinterpret_cast<float*>(dstp[0]);
961+
float* d1 = reinterpret_cast<float*>(dstp[1]);
962+
float* d2 = reinterpret_cast<float*>(dstp[2]);
963+
956964
for (int x = 0; x < width; x++) {
957-
float Y = reinterpret_cast<const float*>(srcp[0])[x] + matrix.offset_y_f;
958-
constexpr float shift = 0.0f;
959-
float U = reinterpret_cast<const float*>(srcp[1])[x] - shift;
960-
float V = reinterpret_cast<const float*>(srcp[2])[x] - shift;
965+
float Y = srcY[x] + matrix.offset_y_f;
966+
constexpr float shift = 0.0f; // intentionally, float UV is zero centered
967+
float U = srcU[x] - shift;
968+
float V = srcV[x] - shift;
961969
float b = matrix.y_b_f * Y + matrix.u_b_f * U + matrix.v_b_f * V + matrix.offset_rgb_f;
962970
float g = matrix.y_g_f * Y + matrix.u_g_f * U + matrix.v_g_f * V + matrix.offset_rgb_f;
963971
float r = matrix.y_r_f * Y + matrix.u_r_f * U + matrix.v_r_f * V + matrix.offset_rgb_f;
972+
973+
d0[x] = g;
974+
d1[x] = b;
975+
d2[x] = r;
964976
}
965977
dstp[1] += dstPitch[1];
966978
dstp[0] += dstPitch[0];

0 commit comments

Comments
 (0)