fix offset bug
This commit is contained in:
@@ -10,7 +10,8 @@ const int IN_SIZE = IN_WIDTH * IN_HEIGHT;
|
||||
const int OUT_WIDTH = 1280;
|
||||
const int OUT_HEIGHT = 720;
|
||||
const int OUT_SIZE = OUT_WIDTH * OUT_HEIGHT;
|
||||
const int RAW_TYPE = 3;
|
||||
const int RAW_TYPE = 1;
|
||||
const int COLOR_DEPTH = 10;
|
||||
|
||||
int main() {
|
||||
std::ifstream in_image;
|
||||
@@ -22,7 +23,7 @@ int main() {
|
||||
uint8_t buf[2] = {0};
|
||||
in_image.read((char*)buf, sizeof(buf));
|
||||
|
||||
image[y][x] = buf[0] + (buf[1] << 8);
|
||||
image[y][x] = buf[0] + ((uint16_t)buf[1] << 8);
|
||||
}
|
||||
|
||||
int raw_type = RAW_TYPE;
|
||||
@@ -91,12 +92,9 @@ int main() {
|
||||
}
|
||||
|
||||
|
||||
// data[index + 0] = red * 8 / 12; // R
|
||||
data[index + 1] = green * 8 / 12; // G
|
||||
// data[index + 2] = blue * 8 / 12; // B
|
||||
data[index + 0] = 0; // R
|
||||
// data[index + 1] = 0; // G
|
||||
data[index + 2] = 0; // B
|
||||
data[index + 0] = red >> (COLOR_DEPTH - 8); // R
|
||||
data[index + 1] = green >> (COLOR_DEPTH - 8); // G
|
||||
data[index + 2] = blue >> (COLOR_DEPTH - 8); // B
|
||||
}
|
||||
|
||||
if (y % 2) {
|
||||
|
Reference in New Issue
Block a user