1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Fix decoding of some 8 < bpc < 16 signed j2k samples with libopenjpeg.

No testcase known.

Reviewed-by: Michael Bradshaw
This commit is contained in:
Carl Eugen Hoyos 2014-01-27 14:28:30 +01:00
parent bceeccc648
commit 05e5bb6107

View File

@ -180,7 +180,8 @@ static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *i
img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]); img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]);
for (x = 0; x < picture->width; x++, index++) { for (x = 0; x < picture->width; x++, index++) {
for (c = 0; c < image->numcomps; c++) { for (c = 0; c < image->numcomps; c++) {
*img_ptr++ = 0x8000 * image->comps[c].sgnd + ((unsigned)image->comps[c].data[index] << adjust[c]); *img_ptr++ = (1 << image->comps[c].prec - 1) * image->comps[c].sgnd +
(unsigned)image->comps[c].data[index] << adjust[c];
} }
} }
} }
@ -217,7 +218,8 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {
for (y = 0; y < image->comps[index].h; y++) { for (y = 0; y < image->comps[index].h; y++) {
img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]); img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]);
for (x = 0; x < image->comps[index].w; x++) { for (x = 0; x < image->comps[index].w; x++) {
*img_ptr = 0x8000 * image->comps[index].sgnd + ((unsigned)*comp_data << adjust[index]); *img_ptr = (1 << image->comps[index].prec - 1) * image->comps[index].sgnd +
(unsigned)*comp_data << adjust[index];
img_ptr++; img_ptr++;
comp_data++; comp_data++;
} }