[cli] Fix yuv_io_seek() buffer type

This commit is contained in:
Marko Viitanen 2024-09-05 14:42:50 +03:00
parent cd65044000
commit 862cc92e97

View file

@ -53,16 +53,16 @@ static void fill_after_frame(unsigned height, unsigned array_width,
} }
static int read_and_fill_frame_data( static int read_and_fill_frame_data(FILE* file,
FILE* file, unsigned width,
unsigned width, unsigned height,
unsigned height, unsigned bytes_per_sample,
unsigned bytes_per_sample, unsigned array_width,
unsigned array_width, uvg_pixel* data)
uvg_pixel* data)
{ {
unsigned i; unsigned i;
// Handle separately the case where we use UVG_BIT_DEPTH 10+ but the input is 8-bit.
if (bytes_per_sample != sizeof(uvg_pixel)) { if (bytes_per_sample != sizeof(uvg_pixel)) {
uint8_t* p = (uint8_t*)data; uint8_t* p = (uint8_t*)data;
uint8_t* end = (uint8_t*)data + array_width * height; uint8_t* end = (uint8_t*)data + array_width * height;
@ -71,7 +71,6 @@ static int read_and_fill_frame_data(
// Read the beginning of the line from input. // Read the beginning of the line from input.
if (width != fread(p, bytes_per_sample, width, file)) return 0; if (width != fread(p, bytes_per_sample, width, file)) return 0;
// Fill the rest with the last pixel value. // Fill the rest with the last pixel value.
// Fill the rest with the last pixel value.
fill_char = p[width - 1]; fill_char = p[width - 1];
for (i = width; i < array_width; ++i) { for (i = width; i < array_width; ++i) {
@ -334,7 +333,7 @@ int yuv_io_seek(FILE* file, unsigned frames,
// Seek failed. Skip data by reading. // Seek failed. Skip data by reading.
error = 0; error = 0;
unsigned char* tmp[4096]; unsigned char tmp[4096];
size_t bytes_left = skip_bytes; size_t bytes_left = skip_bytes;
while (bytes_left > 0 && !error) { while (bytes_left > 0 && !error) {
const size_t skip = MIN(4096, bytes_left); const size_t skip = MIN(4096, bytes_left);