}
} else if (s->pixel_type == EXR_HALF) {
// 16-bit
- if (c < 3) {
+ if (c < 3 || !trc_func) {
for (x = 0; x < xsize; x++) {
*ptr_x++ = s->gamma_table[bytestream_get_le16(&src)];
}
// Zero out the start if ymin is not 0
for (i = 0; i < planes; i++) {
ptr = picture->data[i];
- for (y = 0; y < s->ymin; y++) {
+ for (y = 0; y < FFMIN(s->ymin, s->h); y++) {
memset(ptr, 0, out_line_size);
ptr += picture->linesize[i];
}
ymax = FFMAX(0, s->ymax + 1);
// Zero out the end if ymax+1 is not h
- for (i = 0; i < planes; i++) {
- ptr = picture->data[i] + (ymax * picture->linesize[i]);
- for (y = ymax; y < avctx->height; y++) {
- memset(ptr, 0, out_line_size);
- ptr += picture->linesize[i];
+ if (ymax < avctx->height)
+ for (i = 0; i < planes; i++) {
+ ptr = picture->data[i] + (ymax * picture->linesize[i]);
+ for (y = ymax; y < avctx->height; y++) {
+ memset(ptr, 0, out_line_size);
+ ptr += picture->linesize[i];
+ }
}
- }
picture->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;