mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-20 10:09:15 +00:00
libobs/media-io: Fix decompress_420 function
This function had a number of bugs and just wasn't working properly at all. This function is currently not used in public builds because GPU is used for color conversion instead (hence why it had probably not really been tested), but a need came up where CPU conversion was useful for the sake of testing something else in the back-end, and it needed to be fixed before CPU conversion could be used.
This commit is contained in:
parent
292a6e59f4
commit
849944ca79
|
@ -208,7 +208,7 @@ void decompress_420(
|
|||
uint8_t *output, uint32_t out_linesize)
|
||||
{
|
||||
uint32_t start_y_d2 = start_y/2;
|
||||
uint32_t width_d2 = min_uint32(in_linesize[0], out_linesize)/2;
|
||||
uint32_t width_d2 = in_linesize[0]/2;
|
||||
uint32_t height_d2 = end_y/2;
|
||||
uint32_t y;
|
||||
|
||||
|
@ -221,18 +221,18 @@ void decompress_420(
|
|||
|
||||
lum0 = input[0] + y * 2 * in_linesize[0];
|
||||
lum1 = lum0 + in_linesize[0];
|
||||
output0 = (uint32_t*)(output + y * 2 * in_linesize[0]);
|
||||
output1 = (uint32_t*)((uint8_t*)output0 + in_linesize[0]);
|
||||
output0 = (uint32_t*)(output + y * 2 * out_linesize);
|
||||
output1 = (uint32_t*)((uint8_t*)output0 + out_linesize);
|
||||
|
||||
for (x = 0; x < width_d2; x++) {
|
||||
uint32_t out;
|
||||
out = (*(chroma0++) << 8) | (*(chroma1++) << 16);
|
||||
out = (*(chroma0++) << 8) | *(chroma1++);
|
||||
|
||||
*(output0++) = *(lum0++) | out;
|
||||
*(output0++) = *(lum0++) | out;
|
||||
*(output0++) = (*(lum0++) << 16) | out;
|
||||
*(output0++) = (*(lum0++) << 16) | out;
|
||||
|
||||
*(output1++) = *(lum1++) | out;
|
||||
*(output1++) = *(lum1++) | out;
|
||||
*(output1++) = (*(lum1++) << 16) | out;
|
||||
*(output1++) = (*(lum1++) << 16) | out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue