Skip to content

Commit d85ed5c

Browse files
committed
decoder: fix reinit when Huffman is run on CPU
broken by the commit 41fb824 (15th Jan 2025) The problem is after that change when using CPU Huffman decoder, and using the 2nd image smaller than the first that since the commit, the per-component pointers won't get updated by gpujpeg_coder_allocate_cpu_huffman_buf(), which is no longer called (data_quantizied != NULL).
1 parent 6a24559 commit d85ed5c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/gpujpeg_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,14 +946,17 @@ gpujpeg_coder_init_image(struct gpujpeg_coder * coder, const struct gpujpeg_para
946946
// Set data buffer to color components
947947
uint8_t* d_comp_data = coder->d_data;
948948
int16_t* d_comp_data_quantized = coder->d_data_quantized;
949+
int16_t* comp_data_quantized = coder->data_quantized;
949950
unsigned int data_quantized_index = 0;
950951
for ( int comp = 0; comp < coder->param.comp_count; comp++ ) {
951952
struct gpujpeg_component* component = &coder->component[comp];
952953
component->d_data = d_comp_data;
953954
component->d_data_quantized = d_comp_data_quantized;
954955
component->data_quantized_index = data_quantized_index;
956+
component->data_quantized = comp_data_quantized;
955957
d_comp_data += component->data_width * component->data_height;
956958
d_comp_data_quantized += component->data_width * component->data_height;
959+
comp_data_quantized += component->data_width * component->data_height;
957960
data_quantized_index += component->data_width * component->data_height;
958961
}
959962

0 commit comments

Comments
 (0)