[GPU] Fix convert color I420 (#14679)
This commit is contained in:
parent
9ba6e48dbf
commit
25671ca219
@ -30,9 +30,13 @@ KERNEL(convert_color_ref)(const __global INPUT0_TYPE* input1,
|
||||
float V = input2[GET_DATA_INDEX(INPUT1, b, 1, y / 2, x / 2)];
|
||||
#else // Single plane
|
||||
uint input_uv_offset = INPUT0_SIZE_X * INPUT0_SIZE_Y / 3 * 2;
|
||||
|
||||
#ifdef CONVERT_FROM_NV12
|
||||
float U = input1[GET_DATA_INDEX(INPUT0, b, 0, y / 2, (x / 2) * 2) + input_uv_offset];
|
||||
float V = input1[GET_DATA_INDEX(INPUT0, b, 1, y / 2, (x / 2) * 2) + input_uv_offset];
|
||||
#else
|
||||
float U = input1[GET_DATA_INDEX(INPUT0, b, 0, 0, x / 2 + (y / 2)*(INPUT0_Y_PITCH / 2)) + input_uv_offset];
|
||||
float V = input1[GET_DATA_INDEX(INPUT0, b, 0, 0, x / 2 + (y / 2)*(INPUT0_Y_PITCH / 2)) + 5 * input_uv_offset / 4];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float Ycomponent = mad(Y, 1.164f, -18.624f);
|
||||
|
@ -125,6 +125,5 @@ std::vector<std::string> disabledTestPatterns() {
|
||||
R"(.*smoke_GroupConvolution1D_ExplicitPadding_Disabled.*)",
|
||||
R"(.*smoke_GroupConvolutionLayerGPUTest_dynamic1DSymPad_Disabled.*)",
|
||||
R"(.*smoke_ConvolutionLayerGPUTest_dynamic1DSymPad.*)",
|
||||
R"(.*TestsConvertColorI420.*)",
|
||||
};
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ inline std::vector<uint8_t> color_test_image(size_t height, size_t width, int b_
|
||||
int u_val = ((-38 * r - 74 * g + 112 * b + 128) / 256) + 128;
|
||||
int v_val = ((112 * r - 94 * g + 18 * b + 128) / 256) + 128;
|
||||
|
||||
size_t b_offset = height * width * b / b_step;
|
||||
size_t u_index = b_offset + height * width + y * width / 2 + x * 2;
|
||||
size_t b_offset = height * width * b / b_step * 3 / 2;
|
||||
size_t u_index = b_offset + height * width + y * width / 2 + x;
|
||||
size_t v_index = u_index + height * width / 4;
|
||||
input_yuv[u_index] = u_val;
|
||||
input_yuv[v_index] = v_val;
|
||||
|
@ -72,7 +72,7 @@ inline std::vector<uint8_t> color_test_image(size_t height, size_t width, int b_
|
||||
int u_val = ((-38 * r - 74 * g + 112 * b + 128) / 256) + 128;
|
||||
int v_val = ((112 * r - 94 * g + 18 * b + 128) / 256) + 128;
|
||||
|
||||
size_t b_offset = height * width * b / b_step;
|
||||
size_t b_offset = height * width * b / b_step * 3 / 2;
|
||||
size_t uv_index = b_offset + height * width + y * width + x * 2;
|
||||
input_yuv[uv_index] = u_val;
|
||||
input_yuv[uv_index + 1] = v_val;
|
||||
|
Loading…
Reference in New Issue
Block a user