#11111: When decoding a multilayer DWAA compressed .exr, I get error 
decode_block()
-------------------------------------+-------------------------------------
             Reporter:  Sean         |                    Owner:  (none)
  Devonport                          |
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  exr          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  1            |
-------------------------------------+-------------------------------------
Comment (by Sean Devonport):

 Ah yes, sorry, the strange pixels in the example are from a non-denoised,
 low sampled path traced image. I did that for testing speed. I can
 rerender with a correctly denoised image if it helps.

 It is linear Rec 709 from blender.

 I've been digging through the exr.c code and I think I can see where the
 root of the problem is.

 It seems that ExrThreadData has DCT block array defined by [3][64]. So
 that's 3 channel I would assume.


 {{{
 typedef struct EXRThreadData {
     uint8_t *uncompressed_data;
     int uncompressed_size;

     uint8_t *tmp;
     int tmp_size;

     uint8_t *bitmap;
     uint16_t *lut;

     uint8_t *ac_data;
     unsigned ac_size;

     uint8_t *dc_data;
     unsigned dc_size;

     uint8_t *rle_data;
     unsigned rle_size;

     uint8_t *rle_raw_data;
     unsigned rle_raw_size;

     float block[3][64];    // this would need to be [14][64] for my
 example

     int ysize, xsize;

     int channel_line_size;

     int run_sym;
     HuffEntry *he;
     uint64_t *freq;
     VLC vlc;
 } EXRThreadData;
 }}}


 As well as this, the dwa_uncompress function only has support for 3
 channels, and the loop that does the DCT decoding is only doing it for 3
 channels, and filling the RGB pixels as 3, but in my example it would need
 14 channels (that's 2x layers that are RGB and 2x layers that are RGBA).

 I see that s->nb_channels = 14 so I would imagine we need to run the
 inverse DCT on all 14 channels, and then for each layer, take the decoded
 DCT block and fill in the pixels. I've tried doing this but it's still not
 quite working. I get missing information in the final pixels.


 {{{
 // exr.c
             for (int j = 0; j < 3; j++) // This should be s->nb_channels
 which is 14 in my case
             {
                 float *block = td->block[j];
                 const int idx = (x >> 3) + (y >> 3) * dc_w + dc_w * dc_h *
 j;
                 uint16_t *dc = (uint16_t *)td->dc_data;
                 union av_intfloat32 dc_val;

                 dc_val.i = half2float(dc[idx], &s->h2f_tables);

                 block[0] = dc_val.f;
                 ac_uncompress(s, &agb, block);
                 dct_inverse(block);
             }
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11111#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to