ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Wed May 14 00:17:02 2025 -0300| [038314bc6be2f35a82e9fba2228bcac2e4fee648] | committer: James Almer
avcodec/exr: reindent after the previous change Signed-off-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=038314bc6be2f35a82e9fba2228bcac2e4fee648 --- libavcodec/exr.c | 97 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 8018e3e8c8..0a6aab662e 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1112,6 +1112,11 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse for (int y = 0; y < td->ysize; y += 8) { for (int x = 0; x < td->xsize; x += 8) { + const int o = s->nb_channels == 4; + float *yb = td->block[0]; + float *ub = td->block[1]; + float *vb = td->block[2]; + memset(td->block, 0, sizeof(td->block)); for (int j = 0; j < 3; j++) { @@ -1127,36 +1132,31 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse dct_inverse(block); } - { - const int o = s->nb_channels == 4; - float *yb = td->block[0]; - float *ub = td->block[1]; - float *vb = td->block[2]; - if (s->pixel_type == EXR_HALF) { - uint16_t *bo = ((uint16_t *)td->uncompressed_data) + - y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x; - uint16_t *go = ((uint16_t *)td->uncompressed_data) + - y * td->xsize * s->nb_channels + td->xsize * (o + 1) + x; - uint16_t *ro = ((uint16_t *)td->uncompressed_data) + - y * td->xsize * s->nb_channels + td->xsize * (o + 2) + x; - - for (int yy = 0; yy < 8; yy++) { - for (int xx = 0; xx < 8; xx++) { - const int idx = xx + yy * 8; - float b, g, r; - - convert(yb[idx], ub[idx], vb[idx], &b, &g, &r); - - bo[xx] = float2half(av_float2int(to_linear(b, 1.f)), &s->f2h_tables); - go[xx] = float2half(av_float2int(to_linear(g, 1.f)), &s->f2h_tables); - ro[xx] = float2half(av_float2int(to_linear(r, 1.f)), &s->f2h_tables); - } + if (s->pixel_type == EXR_HALF) { + uint16_t *bo = ((uint16_t *)td->uncompressed_data) + + y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x; + uint16_t *go = ((uint16_t *)td->uncompressed_data) + + y * td->xsize * s->nb_channels + td->xsize * (o + 1) + x; + uint16_t *ro = ((uint16_t *)td->uncompressed_data) + + y * td->xsize * s->nb_channels + td->xsize * (o + 2) + x; + + for (int yy = 0; yy < 8; yy++) { + for (int xx = 0; xx < 8; xx++) { + const int idx = xx + yy * 8; + float b, g, r; - bo += td->xsize * s->nb_channels; - go += td->xsize * s->nb_channels; - ro += td->xsize * s->nb_channels; + convert(yb[idx], ub[idx], vb[idx], &b, &g, &r); + + bo[xx] = float2half(av_float2int(to_linear(b, 1.f)), &s->f2h_tables); + go[xx] = float2half(av_float2int(to_linear(g, 1.f)), &s->f2h_tables); + ro[xx] = float2half(av_float2int(to_linear(r, 1.f)), &s->f2h_tables); } - } else { + + bo += td->xsize * s->nb_channels; + go += td->xsize * s->nb_channels; + ro += td->xsize * s->nb_channels; + } + } else { float *bo = ((float *)td->uncompressed_data) + y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x; float *go = ((float *)td->uncompressed_data) + @@ -1179,7 +1179,6 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse go += td->xsize * s->nb_channels; ro += td->xsize * s->nb_channels; } - } } } } @@ -1197,18 +1196,18 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse ao[x] = ai0[x] | (ai1[x] << 8); } } else { - for (int y = 0; y < td->ysize && td->rle_raw_data; y++) { - uint32_t *ao = ((uint32_t *)td->uncompressed_data) + y * td->xsize * s->nb_channels; - uint8_t *ai0 = td->rle_raw_data + y * td->xsize; - uint8_t *ai1 = td->rle_raw_data + y * td->xsize + rle_raw_size / 2; + for (int y = 0; y < td->ysize && td->rle_raw_data; y++) { + uint32_t *ao = ((uint32_t *)td->uncompressed_data) + y * td->xsize * s->nb_channels; + uint8_t *ai0 = td->rle_raw_data + y * td->xsize; + uint8_t *ai1 = td->rle_raw_data + y * td->xsize + rle_raw_size / 2; - for (int x = 0; x < td->xsize; x++) { - uint16_t ha = ai0[x] | (ai1[x] << 8); + for (int x = 0; x < td->xsize; x++) { + uint16_t ha = ai0[x] | (ai1[x] << 8); - ao[x] = half2float(ha, &s->h2f_tables); + ao[x] = half2float(ha, &s->h2f_tables); + } } } - } return 0; } @@ -2076,20 +2075,20 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, switch (s->pixel_type) { case EXR_HALF: - if (s->channel_offsets[3] >= 0) { - if (!s->is_luma) { - avctx->pix_fmt = AV_PIX_FMT_GBRAPF16; - } else { - avctx->pix_fmt = AV_PIX_FMT_YAF16; - } + if (s->channel_offsets[3] >= 0) { + if (!s->is_luma) { + avctx->pix_fmt = AV_PIX_FMT_GBRAPF16; } else { - if (!s->is_luma) { - avctx->pix_fmt = AV_PIX_FMT_GBRPF16; - } else { - avctx->pix_fmt = AV_PIX_FMT_GRAYF16; - } + avctx->pix_fmt = AV_PIX_FMT_YAF16; } - break; + } else { + if (!s->is_luma) { + avctx->pix_fmt = AV_PIX_FMT_GBRPF16; + } else { + avctx->pix_fmt = AV_PIX_FMT_GRAYF16; + } + } + break; case EXR_FLOAT: if (s->channel_offsets[3] >= 0) { if (!s->is_luma) { _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".