exr: shorter channel buffer names

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2013-02-22 12:17:17 +00:00
parent 7a930f310a
commit 89c77b6b15

View File

@ -523,7 +523,7 @@ static int decode_frame(AVCodecContext *avctx,
// Process the actual scan line blocks // Process the actual scan line blocks
for (y = ymin; y <= ymax; y += scan_lines_per_block) { for (y = ymin; y <= ymax; y += scan_lines_per_block) {
uint16_t *ptr_x; uint16_t *ptr_x;
const uint8_t *red_channel_buffer, *green_channel_buffer, *blue_channel_buffer, *alpha_channel_buffer = 0; const uint8_t *channel_buffer[4] = { 0 };
const uint64_t line_offset = bytestream_get_le64(&buf); const uint64_t line_offset = bytestream_get_le64(&buf);
int32_t data_size, line; int32_t data_size, line;
@ -567,28 +567,28 @@ static int decode_frame(AVCodecContext *avctx,
predictor(s->tmp, uncompressed_size); predictor(s->tmp, uncompressed_size);
reorder_pixels(s->tmp, s->uncompressed_data, uncompressed_size); reorder_pixels(s->tmp, s->uncompressed_data, uncompressed_size);
red_channel_buffer = s->uncompressed_data + xdelta * s->channel_offsets[0]; channel_buffer[0] = s->uncompressed_data + xdelta * s->channel_offsets[0];
green_channel_buffer = s->uncompressed_data + xdelta * s->channel_offsets[1]; channel_buffer[1] = s->uncompressed_data + xdelta * s->channel_offsets[1];
blue_channel_buffer = s->uncompressed_data + xdelta * s->channel_offsets[2]; channel_buffer[2] = s->uncompressed_data + xdelta * s->channel_offsets[2];
if (s->channel_offsets[3] >= 0) if (s->channel_offsets[3] >= 0)
alpha_channel_buffer = s->uncompressed_data + xdelta * s->channel_offsets[3]; channel_buffer[3] = s->uncompressed_data + xdelta * s->channel_offsets[3];
} else { } else {
red_channel_buffer = src + xdelta * s->channel_offsets[0]; channel_buffer[0] = src + xdelta * s->channel_offsets[0];
green_channel_buffer = src + xdelta * s->channel_offsets[1]; channel_buffer[1] = src + xdelta * s->channel_offsets[1];
blue_channel_buffer = src + xdelta * s->channel_offsets[2]; channel_buffer[2] = src + xdelta * s->channel_offsets[2];
if (s->channel_offsets[3] >= 0) if (s->channel_offsets[3] >= 0)
alpha_channel_buffer = src + xdelta * s->channel_offsets[3]; channel_buffer[3] = src + xdelta * s->channel_offsets[3];
} }
ptr = p->data[0] + line * stride; ptr = p->data[0] + line * stride;
for (i = 0; i < scan_lines_per_block && y + i <= ymax; i++, ptr += stride) { for (i = 0; i < scan_lines_per_block && y + i <= ymax; i++, ptr += stride) {
const uint8_t *r, *g, *b, *a; const uint8_t *r, *g, *b, *a;
r = red_channel_buffer; r = channel_buffer[0];
g = green_channel_buffer; g = channel_buffer[1];
b = blue_channel_buffer; b = channel_buffer[2];
if (alpha_channel_buffer) if (channel_buffer[3])
a = alpha_channel_buffer; a = channel_buffer[3];
ptr_x = (uint16_t *)ptr; ptr_x = (uint16_t *)ptr;
@ -601,7 +601,7 @@ static int decode_frame(AVCodecContext *avctx,
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&r)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&r));
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&g)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&g));
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&b)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&b));
if (alpha_channel_buffer) if (channel_buffer[3])
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a));
} }
} else { } else {
@ -610,7 +610,7 @@ static int decode_frame(AVCodecContext *avctx,
*ptr_x++ = exr_halflt2uint(bytestream_get_le16(&r)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&r));
*ptr_x++ = exr_halflt2uint(bytestream_get_le16(&g)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&g));
*ptr_x++ = exr_halflt2uint(bytestream_get_le16(&b)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&b));
if (alpha_channel_buffer) if (channel_buffer[3])
*ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a));
} }
} }
@ -618,11 +618,11 @@ static int decode_frame(AVCodecContext *avctx,
// Zero out the end if xmax+1 is not w // Zero out the end if xmax+1 is not w
memset(ptr_x, 0, axmax); memset(ptr_x, 0, axmax);
red_channel_buffer += scan_line_size; channel_buffer[0] += scan_line_size;
green_channel_buffer += scan_line_size; channel_buffer[1] += scan_line_size;
blue_channel_buffer += scan_line_size; channel_buffer[2] += scan_line_size;
if (alpha_channel_buffer) if (channel_buffer[3])
alpha_channel_buffer += scan_line_size; channel_buffer[3] += scan_line_size;
} }
} }