Added a new function to get RgbStride (#352)

* re-org videodecodeRGB sample

* minor fix

* removed un-necessary include

* minor fix

* added GetRgbStride utility function for RGB stride

* fix for review comments

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>

[ROCm/rocdecode commit: dd30db9f51]
Tá an tiomantas seo le fáil i:
Rajy Rawther
2024-05-13 09:39:38 -07:00
tiomanta ag GitHub
tuismitheoir 8d9785072d
tiomantas 5105e2d7b3
D'athraigh 2 comhad le 13 breiseanna agus 9 scriosta
@@ -119,15 +119,8 @@ void ColorSpaceConversionThread(std::atomic<bool>& continue_processing, bool con
}
if (convert_to_rgb) {
int rgb_width;
if (p_surf_info->bit_depth == 8) {
rgb_width = (p_surf_info->output_width + 1) & ~1; // has to be a multiple of 2 for hip colorconvert kernels
rgb_image_size = ((e_output_format == bgr) || (e_output_format == rgb)) ? rgb_width * p_surf_info->output_height * 3 : rgb_width * p_surf_info->output_height * 4;
} else {
rgb_width = (p_surf_info->output_width + 1) & ~1;
rgb_image_size = ((e_output_format == bgr) || (e_output_format == rgb)) ? rgb_width * p_surf_info->output_height * 3 : ((e_output_format == bgr48) || (e_output_format == rgb48)) ?
rgb_width * p_surf_info->output_height * 6 : rgb_width * p_surf_info->output_height * 8;
}
uint32_t rgb_stride = post_proc.GetRgbStride(e_output_format, p_surf_info);
rgb_image_size = p_surf_info->output_height * rgb_stride;
if (p_rgb_dev_mem == nullptr) {
hip_status = hipMalloc(&p_rgb_dev_mem, rgb_image_size);
if (hip_status != hipSuccess) {