History

avcodec/exr: reindent after the previous change

James Almer committed 1 year ago

Commit 038314b1 parent 527d5ea1 file · +48 −49Browse files

Unified · Split

libavcodec/exr.c+48−49
@@ -1112,6 +1112,11 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse · 1111 unmodified lines
11121112
11131113 for (int y = 0; y < td->ysize; y += 8) {
11141114 for (int x = 0; x < td->xsize; x += 8) {
1115+ const int o = s->nb_channels == 4;
1116+ float *yb = td->block[0];
1117+ float *ub = td->block[1];
1118+ float *vb = td->block[2];
1119+
11151120 memset(td->block, 0, sizeof(td->block));
11161121
11171122 for (int j = 0; j < 3; j++) {
@@ -1127,36 +1132,31 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse · 9 unmodified lines
11271132 dct_inverse(block);
11281133 }
11291134
1130− {
1131− const int o = s->nb_channels == 4;
1132− float *yb = td->block[0];
1133− float *ub = td->block[1];
1134− float *vb = td->block[2];
1135− if (s->pixel_type == EXR_HALF) {
1136− uint16_t *bo = ((uint16_t *)td->uncompressed_data) +
1137− y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x;
1138− uint16_t *go = ((uint16_t *)td->uncompressed_data) +
1139− y * td->xsize * s->nb_channels + td->xsize * (o + 1) + x;
1140− uint16_t *ro = ((uint16_t *)td->uncompressed_data) +
1141− y * td->xsize * s->nb_channels + td->xsize * (o + 2) + x;
1142−
1143− for (int yy = 0; yy < 8; yy++) {
1144− for (int xx = 0; xx < 8; xx++) {
1145− const int idx = xx + yy * 8;
1146− float b, g, r;
1147−
1148− convert(yb[idx], ub[idx], vb[idx], &b, &g, &r);
1149−
1150− bo[xx] = float2half(av_float2int(to_linear(b, 1.f)), &s->f2h_tables);
1151− go[xx] = float2half(av_float2int(to_linear(g, 1.f)), &s->f2h_tables);
1152− ro[xx] = float2half(av_float2int(to_linear(r, 1.f)), &s->f2h_tables);
1153− }
1135+ if (s->pixel_type == EXR_HALF) {
1136+ uint16_t *bo = ((uint16_t *)td->uncompressed_data) +
1137+ y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x;
1138+ uint16_t *go = ((uint16_t *)td->uncompressed_data) +
1139+ y * td->xsize * s->nb_channels + td->xsize * (o + 1) + x;
1140+ uint16_t *ro = ((uint16_t *)td->uncompressed_data) +
1141+ y * td->xsize * s->nb_channels + td->xsize * (o + 2) + x;
1142+
1143+ for (int yy = 0; yy < 8; yy++) {
1144+ for (int xx = 0; xx < 8; xx++) {
1145+ const int idx = xx + yy * 8;
1146+ float b, g, r;
11541147
1155− bo += td->xsize * s->nb_channels;
1156− go += td->xsize * s->nb_channels;
1157− ro += td->xsize * s->nb_channels;
1148+ convert(yb[idx], ub[idx], vb[idx], &b, &g, &r);
1149+
1150+ bo[xx] = float2half(av_float2int(to_linear(b, 1.f)), &s->f2h_tables);
1151+ go[xx] = float2half(av_float2int(to_linear(g, 1.f)), &s->f2h_tables);
1152+ ro[xx] = float2half(av_float2int(to_linear(r, 1.f)), &s->f2h_tables);
11581153 }
1159− } else {
1154+
1155+ bo += td->xsize * s->nb_channels;
1156+ go += td->xsize * s->nb_channels;
1157+ ro += td->xsize * s->nb_channels;
1158+ }
1159+ } else {
11601160 float *bo = ((float *)td->uncompressed_data) +
11611161 y * td->xsize * s->nb_channels + td->xsize * (o + 0) + x;
11621162 float *go = ((float *)td->uncompressed_data) +
@@ -1179,7 +1179,6 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse · 16 unmodified lines
11791179 go += td->xsize * s->nb_channels;
11801180 ro += td->xsize * s->nb_channels;
11811181 }
1182− }
11831182 }
11841183 }
11851184 }
@@ -1197,18 +1196,18 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse · 11 unmodified lines
11971196 ao[x] = ai0[x] | (ai1[x] << 8);
11981197 }
11991198 } else {
1200− for (int y = 0; y < td->ysize && td->rle_raw_data; y++) {
1201− uint32_t *ao = ((uint32_t *)td->uncompressed_data) + y * td->xsize * s->nb_channels;
1202− uint8_t *ai0 = td->rle_raw_data + y * td->xsize;
1203− uint8_t *ai1 = td->rle_raw_data + y * td->xsize + rle_raw_size / 2;
1199+ for (int y = 0; y < td->ysize && td->rle_raw_data; y++) {
1200+ uint32_t *ao = ((uint32_t *)td->uncompressed_data) + y * td->xsize * s->nb_channels;
1201+ uint8_t *ai0 = td->rle_raw_data + y * td->xsize;
1202+ uint8_t *ai1 = td->rle_raw_data + y * td->xsize + rle_raw_size / 2;
12041203
1205− for (int x = 0; x < td->xsize; x++) {
1206− uint16_t ha = ai0[x] | (ai1[x] << 8);
1204+ for (int x = 0; x < td->xsize; x++) {
1205+ uint16_t ha = ai0[x] | (ai1[x] << 8);
12071206
1208− ao[x] = half2float(ha, &s->h2f_tables);
1207+ ao[x] = half2float(ha, &s->h2f_tables);
1208+ }
12091209 }
12101210 }
1211− }
12121211
12131212 return 0;
12141213 }
@@ -2076,20 +2075,20 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 861 unmodified lines
20762075
20772076 switch (s->pixel_type) {
20782077 case EXR_HALF:
2079− if (s->channel_offsets[3] >= 0) {
2080− if (!s->is_luma) {
2081− avctx->pix_fmt = AV_PIX_FMT_GBRAPF16;
2082− } else {
2083− avctx->pix_fmt = AV_PIX_FMT_YAF16;
2084− }
2078+ if (s->channel_offsets[3] >= 0) {
2079+ if (!s->is_luma) {
2080+ avctx->pix_fmt = AV_PIX_FMT_GBRAPF16;
20852081 } else {
2086− if (!s->is_luma) {
2087− avctx->pix_fmt = AV_PIX_FMT_GBRPF16;
2088− } else {
2089− avctx->pix_fmt = AV_PIX_FMT_GRAYF16;
2090− }
2082+ avctx->pix_fmt = AV_PIX_FMT_YAF16;
20912083 }
2092− break;
2084+ } else {
2085+ if (!s->is_luma) {
2086+ avctx->pix_fmt = AV_PIX_FMT_GBRPF16;
2087+ } else {
2088+ avctx->pix_fmt = AV_PIX_FMT_GRAYF16;
2089+ }
2090+ }
2091+ break;
20932092 case EXR_FLOAT:
20942093 if (s->channel_offsets[3] >= 0) {
20952094 if (!s->is_luma) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t