-
-
Save vigneshvg/09c8414b94187349429641171475ce47 to your computer and use it in GitHub Desktop.
libyuv conversion code highlighting a potential clang bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <libyuv.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main(void) { | |
constexpr int bsize = 128 * 10; | |
constexpr int stride = 128; | |
uint8_t buf[4][bsize]; | |
uint8_t pvalue[4] = {29, 255, 107, 255}; | |
for (int p = 0; p < 4; ++p) { | |
uint8_t* pdata = buf[p]; | |
for (int y = 0; y < 10; ++y) { | |
for (int x = 0; x < 128; ++x) { | |
pdata[x] = (x < 16) ? pvalue[p] : 0; | |
} | |
pdata += stride; | |
} | |
} | |
fprintf(stderr, "\n\n"); | |
uint8_t rgb[100 * 10]; | |
int rgbstride = 100; | |
int width = 14; | |
libyuv::I444AlphaToARGBMatrix(buf[0], stride, buf[1], stride, buf[2], stride, | |
buf[3], stride, rgb, rgbstride, | |
&libyuv::kYuvI601Constants, width, 10, 0); | |
uint8_t* base_data = rgb; | |
for (int y = 0; y < 10; ++y) { | |
uint8_t* pdata = base_data; | |
for (int x = 0; x < width; ++x) { | |
fprintf(stderr, "### (%d, %d) %d %d %d %d\n", y, x, pdata[1], pdata[2], | |
pdata[3], pdata[0]); | |
pdata += 4; | |
} | |
base_data += rgbstride; | |
} | |
fprintf(stderr, "hello\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment