43     { 1, 0x00000000 }, { 2, 0x00000002 }, { 3, 0x00000007 }, { 5, 0x00000019 }, { 6, 0x00000030 },
 
   44     { 6, 0x00000036 }, { 7, 0x00000063 }, { 7, 0x0000006B }, { 7, 0x0000006F }, { 8, 0x000000D4 },
 
   45     { 8, 0x000000DC }, { 9, 0x00000189 }, { 9, 0x000001A0 }, { 9, 0x000001AB }, {10, 0x00000310 },
 
   46     {10, 0x00000316 }, {10, 0x00000354 }, {10, 0x00000375 }, {10, 0x00000377 }, {11, 0x00000623 },
 
   47     {11, 0x00000684 }, {11, 0x000006AB }, {11, 0x000006EC }, {12, 0x00000C44 }, {12, 0x00000C5C },
 
   48     {12, 0x00000C5E }, {12, 0x00000D55 }, {12, 0x00000DD1 }, {12, 0x00000DD3 }, {12, 0x00000DDB },
 
   49     {13, 0x0000188B }, {13, 0x000018BB }, {13, 0x00001AA8 }, {13, 0x00001BA0 }, {13, 0x00001BA4 },
 
   50     {13, 0x00001BB5 }, {14, 0x00003115 }, {14, 0x00003175 }, {14, 0x0000317D }, {14, 0x00003553 },
 
   51     {14, 0x00003768 }, {15, 0x00006228 }, {15, 0x000062E8 }, {15, 0x000062F8 }, {15, 0x00006AA4 },
 
   52     {15, 0x00006E85 }, {15, 0x00006E87 }, {15, 0x00006ED3 }, {16, 0x0000C453 }, {16, 0x0000C5D3 },
 
   53     {16, 0x0000C5F3 }, {16, 0x0000DD08 }, {16, 0x0000DD0C }, {16, 0x0000DDA4 }, {17, 0x000188A4 },
 
   54     {17, 0x00018BA5 }, {17, 0x00018BE5 }, {17, 0x0001AA95 }, {17, 0x0001AA97 }, {17, 0x0001BA13 },
 
   55     {17, 0x0001BB4A }, {17, 0x0001BB4B }, {18, 0x00031748 }, {18, 0x000317C8 }, {18, 0x00035528 },
 
   56     {18, 0x0003552C }, {18, 0x00037424 }, {18, 0x00037434 }, {18, 0x00037436 }, {19, 0x00062294 },
 
   57     {19, 0x00062E92 }, {19, 0x00062F92 }, {19, 0x0006AA52 }, {19, 0x0006AA5A }, {19, 0x0006E84A },
 
   58     {19, 0x0006E86A }, {19, 0x0006E86E }, {20, 0x000C452A }, {20, 0x000C5D27 }, {20, 0x000C5F26 },
 
   59     {20, 0x000D54A6 }, {20, 0x000D54B6 }, {20, 0x000DD096 }, {20, 0x000DD0D6 }, {20, 0x000DD0DE },
 
   60     {21, 0x00188A56 }, {21, 0x0018BA4D }, {21, 0x0018BE4E }, {21, 0x0018BE4F }, {21, 0x001AA96E },
 
   61     {21, 0x001BA12E }, {21, 0x001BA12F }, {21, 0x001BA1AF }, {21, 0x001BA1BF }, {22, 0x00317498 },
 
   62     {22, 0x0035529C }, {22, 0x0035529D }, {22, 0x003552DE }, {22, 0x003552DF }, {22, 0x0037435D },
 
   63     {22, 0x0037437D }, {23, 0x0062295D }, {23, 0x0062E933 }, {23, 0x006AA53D }, {23, 0x006AA53E },
 
   64     {23, 0x006AA53F }, {23, 0x006E86B9 }, {23, 0x006E86F8 }, {24, 0x00C452B8 }, {24, 0x00C5D265 },
 
   65     {24, 0x00D54A78 }, {24, 0x00D54A79 }, {24, 0x00DD0D70 }, {24, 0x00DD0D71 }, {24, 0x00DD0DF2 },
 
   66     {24, 0x00DD0DF3 }, {26, 0x03114BA2 }, {25, 0x0188A5B1 }, {25, 0x0188A58B }, {25, 0x0188A595 },
 
   67     {25, 0x0188A5D6 }, {25, 0x0188A5D7 }, {25, 0x0188A5A8 }, {25, 0x0188A5AE }, {25, 0x0188A5AF },
 
   68     {25, 0x0188A5C4 }, {25, 0x0188A5C5 }, {25, 0x0188A587 }, {25, 0x0188A584 }, {25, 0x0188A585 },
 
   69     {25, 0x0188A5C6 }, {25, 0x0188A5C7 }, {25, 0x0188A5CC }, {25, 0x0188A5CD }, {25, 0x0188A581 },
 
   70     {25, 0x0188A582 }, {25, 0x0188A583 }, {25, 0x0188A5CE }, {25, 0x0188A5CF }, {25, 0x0188A5C2 },
 
   71     {25, 0x0188A5C3 }, {25, 0x0188A5C1 }, {25, 0x0188A5B4 }, {25, 0x0188A5B5 }, {25, 0x0188A5E6 },
 
   72     {25, 0x0188A5E7 }, {25, 0x0188A5E4 }, {25, 0x0188A5E5 }, {25, 0x0188A5AB }, {25, 0x0188A5E0 },
 
   73     {25, 0x0188A5E1 }, {25, 0x0188A5E2 }, {25, 0x0188A5E3 }, {25, 0x0188A5B6 }, {25, 0x0188A5B7 },
 
   74     {25, 0x0188A5FD }, {25, 0x0188A57E }, {25, 0x0188A57F }, {25, 0x0188A5EC }, {25, 0x0188A5ED },
 
   75     {25, 0x0188A5FE }, {25, 0x0188A5FF }, {25, 0x0188A57D }, {25, 0x0188A59C }, {25, 0x0188A59D },
 
   76     {25, 0x0188A5E8 }, {25, 0x0188A5E9 }, {25, 0x0188A5EA }, {25, 0x0188A5EB }, {25, 0x0188A5EF },
 
   77     {25, 0x0188A57A }, {25, 0x0188A57B }, {25, 0x0188A578 }, {25, 0x0188A579 }, {25, 0x0188A5BA },
 
   78     {25, 0x0188A5BB }, {25, 0x0188A5B8 }, {25, 0x0188A5B9 }, {25, 0x0188A588 }, {25, 0x0188A589 },
 
   79     {25, 0x018BA4C8 }, {25, 0x018BA4C9 }, {25, 0x0188A5FA }, {25, 0x0188A5FB }, {25, 0x0188A5BC },
 
   80     {25, 0x0188A5BD }, {25, 0x0188A598 }, {25, 0x0188A599 }, {25, 0x0188A5F4 }, {25, 0x0188A5F5 },
 
   81     {25, 0x0188A59B }, {25, 0x0188A5DE }, {25, 0x0188A5DF }, {25, 0x0188A596 }, {25, 0x0188A597 },
 
   82     {25, 0x0188A5F8 }, {25, 0x0188A5F9 }, {25, 0x0188A5F1 }, {25, 0x0188A58E }, {25, 0x0188A58F },
 
   83     {25, 0x0188A5DC }, {25, 0x0188A5DD }, {25, 0x0188A5F2 }, {25, 0x0188A5F3 }, {25, 0x0188A58C },
 
   84     {25, 0x0188A58D }, {25, 0x0188A5A4 }, {25, 0x0188A5F0 }, {25, 0x0188A5A5 }, {25, 0x0188A5A6 },
 
   85     {25, 0x0188A5A7 }, {25, 0x0188A59A }, {25, 0x0188A5A2 }, {25, 0x0188A5A3 }, {25, 0x0188A58A },
 
   86     {25, 0x0188A5B0 }, {25, 0x0188A5A0 }, {25, 0x0188A5A1 }, {25, 0x0188A5DA }, {25, 0x0188A5DB },
 
   87     {25, 0x0188A59E }, {25, 0x0188A59F }, {25, 0x0188A5D8 }, {25, 0x0188A5EE }, {25, 0x0188A5D9 },
 
   88     {25, 0x0188A5F6 }, {25, 0x0188A5F7 }, {25, 0x0188A57C }, {25, 0x0188A5C8 }, {25, 0x0188A5C9 },
 
   89     {25, 0x0188A594 }, {25, 0x0188A5FC }, {25, 0x0188A5CA }, {25, 0x0188A5CB }, {25, 0x0188A5B2 },
 
   90     {25, 0x0188A5AA }, {25, 0x0188A5B3 }, {25, 0x0188A572 }, {25, 0x0188A573 }, {25, 0x0188A5C0 },
 
   91     {25, 0x0188A5BE }, {25, 0x0188A5BF }, {25, 0x0188A592 }, {25, 0x0188A580 }, {25, 0x0188A593 },
 
   92     {25, 0x0188A590 }, {25, 0x0188A591 }, {25, 0x0188A586 }, {25, 0x0188A5A9 }, {25, 0x0188A5D2 },
 
   93     {25, 0x0188A5D3 }, {25, 0x0188A5D4 }, {25, 0x0188A5D5 }, {25, 0x0188A5AC }, {25, 0x0188A5AD },
 
   99     {1,  0x0000,   1}, {2,  0x0000,   2}, {3,  0x0000,   3}, {4,  0x0000,   4},
 
  100     {5,  0x0000,   5}, {6,  0x0000,   6}, {7,  0x0000,   7}, {8,  0x0000,   8},
 
  101     {9,  0x0000,   9}, {10, 0x0000,  10}, {11, 0x0000,  11},
 
  102     {7,  0x0069,  12}, {8,  0x00D1,  20}, {9,  0x018A,  32},
 
  103     {10, 0x0343,  60}, {11, 0x0685, 100}, {13, 0x18BF, 180}, {13, 0x1BA5, 320},
 
  112         { 16, 16,  8,  4,  4,  2,   6,   6,   9, }, 
 
  113         { 16, 16,  8,  4,  4,  2,   6,   6,   9, }, 
 
  114         { 16, 16,  8,  4,  4,  2,   7,   7,  10, }, 
 
  115         { 16, 16,  8,  4,  4,  2,   8,   8,  12, }, 
 
  116         { 16, 16,  8,  4,  4,  2,  16,  16,  26, }, 
 
  117         { 24, 24, 12,  6,  6,  3,  24,  24,  36, }, 
 
  118         { 24, 24, 12,  6,  6,  3,  24,  24,  36, }, 
 
  119         { 32, 32, 24,  8,  8,  6,  32,  32,  48, }, 
 
  120         { 32, 32, 24,  8,  8,  6,  32,  32,  48, }, 
 
  121         { 48, 48, 32, 12, 12,  8,  64,  64,  96, }, 
 
  122         { 48, 48, 32, 12, 12,  8,  64,  64,  96, }, 
 
  123         { 64, 64, 48, 16, 16, 12,  96,  96, 144, }, 
 
  124         { 64, 64, 48, 16, 16, 12, 128, 128, 192, }, 
 
  127         { 16, 16,  8,  4,  4,  2,   6,   6,   9, }, 
 
  128         { 16, 16,  8,  4,  4,  2,   6,   6,  12, }, 
 
  129         { 16, 16,  8,  4,  4,  2,   7,   7,  14, }, 
 
  130         { 16, 16,  8,  4,  4,  2,   8,   8,  16, }, 
 
  131         { 16, 16,  8,  4,  4,  2,  16,  16,  26, }, 
 
  132         { 24, 24, 12,  6,  6,  3,  24,  24,  36, }, 
 
  133         { 24, 24, 12,  6,  6,  3,  24,  24,  48, }, 
 
  134         { 32, 32, 24,  8,  8,  6,  32,  32,  48, }, 
 
  135         { 48, 48, 32, 12, 12,  8,  32,  32,  64, }, 
 
  136         { 48, 48, 32, 12, 12,  8,  64,  64,  96, }, 
 
  137         { 48, 48, 32, 12, 12,  8,  64,  64, 128, }, 
 
  138         { 64, 64, 48, 16, 16, 12,  96,  96, 160, }, 
 
  139         { 64, 64, 48, 16, 16, 12, 128, 128, 192, }, 
 
  142         { 16, 16,  8,  4,  4,  2,   6,   6,   9, }, 
 
  143         { 16, 16,  8,  4,  4,  2,   6,   6,  12, }, 
 
  144         { 16, 16,  8,  4,  4,  2,   7,   7,  14, }, 
 
  145         { 16, 16,  8,  4,  4,  2,   8,   8,  16, }, 
 
  146         { 16, 16,  8,  4,  4,  2,  16,  16,  26, }, 
 
  147         { 24, 24, 12,  6,  6,  3,  24,  24,  36, }, 
 
  148         { 24, 24, 12,  6,  6,  3,  24,  24,  48, }, 
 
  149         { 32, 32, 24,  8,  8,  6,  32,  32,  48, }, 
 
  150         { 48, 48, 32, 12, 12,  8,  32,  32,  64, }, 
 
  151         { 48, 48, 32, 12, 12,  8,  64,  64,  96, }, 
 
  152         { 48, 48, 32, 12, 12,  8,  64,  64, 128, }, 
 
  153         { 64, 64, 48, 16, 16, 12,  96,  96, 160, }, 
 
  154         { 64, 64, 48, 16, 16, 12, 128, 128, 192, }, 
 
  157         { 16, 16,  8, 16, 16,  8,  24,  24,  36, }, 
 
  158         { 16, 16,  8, 16, 16,  8,  24,  24,  36, }, 
 
  159         { 16, 16,  8, 16, 16,  8,  32,  32,  48, }, 
 
  160         { 16, 16,  8, 16, 16,  8,  32,  32,  48, }, 
 
  161         { 16, 16,  8, 20, 20, 10,  80,  80, 128, }, 
 
  162         { 24, 24, 12, 24, 24, 12,  96,  96, 144, }, 
 
  163         { 24, 24, 12, 24, 24, 12,  96,  96, 144, }, 
 
  164         { 32, 32, 24, 32, 32, 24, 128, 128, 192, }, 
 
  165         { 32, 32, 24, 32, 32, 24, 128, 128, 192, }, 
 
  166         { 48, 48, 32, 48, 48, 32, 256, 256, 384, }, 
 
  167         { 48, 48, 32, 48, 48, 32, 256, 256, 384, }, 
 
  168         { 56, 56, 40, 56, 56, 40, 512, 512, 768, }, 
 
  169         { 64, 64, 48, 64, 64, 48, 512, 512, 768, }, 
 
  172         { 16, 16,  8, 16, 16,  8,  24,  24,  36, }, 
 
  173         { 16, 16,  8, 16, 16,  8,  48,  48,  72, }, 
 
  174         { 16, 16,  8, 16, 16,  8,  48,  48,  72, }, 
 
  175         { 16, 16,  8, 16, 16,  8,  64,  64,  96, }, 
 
  176         { 16, 16,  8, 20, 20, 10,  80,  80, 128, }, 
 
  177         { 24, 24, 12, 24, 24, 12,  96,  96, 144, }, 
 
  178         { 24, 24, 12, 24, 24, 12, 192, 192, 288, }, 
 
  179         { 32, 32, 24, 32, 32, 24, 128, 128, 192, }, 
 
  180         { 32, 32, 24, 32, 32, 24, 256, 256, 384, }, 
 
  181         { 48, 48, 32, 48, 48, 32, 256, 256, 384, }, 
 
  182         { 48, 48, 32, 48, 48, 32, 512, 512, 768, }, 
 
  183         { 56, 56, 40, 56, 56, 40, 512, 512, 768, }, 
 
  184         { 64, 64, 48, 64, 64, 48,1024,1024,1536, }, 
 
  187         { 16, 16,  8, 16, 16,  8,  24,  24,  36, }, 
 
  188         { 16, 16,  8, 16, 16,  8,  48,  48,  72, }, 
 
  189         { 16, 16,  8, 16, 16,  8,  48,  48,  72, }, 
 
  190         { 16, 16,  8, 16, 16,  8,  64,  64,  96, }, 
 
  191         { 16, 16, 10, 20, 20, 10,  80,  80, 128, }, 
 
  192         { 24, 24, 12, 24, 24, 12,  96,  96, 144, }, 
 
  193         { 24, 24, 12, 24, 24, 12, 192, 192, 288, }, 
 
  194         { 32, 32, 24, 32, 32, 24, 128, 128, 192, }, 
 
  195         { 32, 32, 24, 32, 32, 24, 256, 256, 384, }, 
 
  196         { 48, 48, 32, 48, 48, 32, 256, 256, 384, }, 
 
  197         { 48, 48, 32, 48, 48, 32, 512, 512, 768, }, 
 
  198         { 56, 56, 40, 56, 56, 40, 512, 512, 768, }, 
 
  199         { 64, 64, 48, 64, 64, 48,1024,1024,1536, }, 
 
  250     const int sign_mask = 256;
 
  251     const int twos_complement = -sign_mask;
 
  252     const int mag_mask = sign_mask - 1;
 
  266     if (avctx->
width & 15) {
 
  273     for (
int i = 0; 
i < 
s->planes; 
i++) {
 
  274         int w8, h8, w4, h4, w2, h2;
 
  277         int height = 
i ? a_height >> 
s->chroma_v_shift: a_height;
 
  286         s->plane[
i].dwt_buf =
 
  287             av_calloc(h8 * 8 * w8 * 8, 
sizeof(*
s->plane[
i].dwt_buf));
 
  288         s->plane[
i].dwt_tmp =
 
  290         if (!
s->plane[
i].dwt_buf || !
s->plane[
i].dwt_tmp)
 
  293         s->plane[
i].subband[0] = 
s->plane[
i].dwt_buf;
 
  294         s->plane[
i].subband[1] = 
s->plane[
i].dwt_buf + 2 * w8 * h8;
 
  295         s->plane[
i].subband[2] = 
s->plane[
i].dwt_buf + 1 * w8 * h8;
 
  296         s->plane[
i].subband[3] = 
s->plane[
i].dwt_buf + 3 * w8 * h8;
 
  297         s->plane[
i].subband[4] = 
s->plane[
i].dwt_buf + 2 * w4 * h4;
 
  298         s->plane[
i].subband[5] = 
s->plane[
i].dwt_buf + 1 * w4 * h4;
 
  299         s->plane[
i].subband[6] = 
s->plane[
i].dwt_buf + 3 * w4 * h4;
 
  300         s->plane[
i].subband[7] = 
s->plane[
i].dwt_buf + 2 * w2 * h2;
 
  301         s->plane[
i].subband[8] = 
s->plane[
i].dwt_buf + 1 * w2 * h2;
 
  302         s->plane[
i].subband[9] = 
s->plane[
i].dwt_buf + 3 * w2 * h2;
 
  306                 s->plane[
i].band[j][k].width  = (
width / 8) << j;
 
  308                 s->plane[
i].band[j][k].a_width  = w8 << j;
 
  309                 s->plane[
i].band[j][k].a_height = h8 << j;
 
  314         s->plane[
i].l_h[0] = 
s->plane[
i].dwt_tmp;
 
  315         s->plane[
i].l_h[1] = 
s->plane[
i].dwt_tmp + 2 * w8 * h8;
 
  317         s->plane[
i].l_h[3] = 
s->plane[
i].dwt_tmp;
 
  318         s->plane[
i].l_h[4] = 
s->plane[
i].dwt_tmp + 2 * w4 * h4;
 
  320         s->plane[
i].l_h[6] = 
s->plane[
i].dwt_tmp;
 
  321         s->plane[
i].l_h[7] = 
s->plane[
i].dwt_tmp + 2 * w2 * h2;
 
  324     for (
int i = 0; 
i < 512; 
i++) {
 
  325         int value = (
i & sign_mask) ? twos_complement + (
i & mag_mask): 
i;
 
  337     s->cb[512].bits = 0x3114ba3;
 
  338     s->cb[512].size = 26;
 
  342     for (
int i = 1, j = 0; 
i < 320 && j < 17; j++) {
 
  355     s->rb[320].run = 320;
 
  357     for (
int i = 0; 
i < 256; 
i++) {
 
  358         int idx = 
i + ((768LL * 
i * 
i * 
i) / (256 * 256 * 256));
 
  362     for (
int i = 0; 
i < 1024; 
i++) {
 
  382                           int height, 
unsigned quantization)
 
  384     const int16_t 
factor = (uint32_t)(1
U << 15) / quantization;
 
  387         for (
int j = 0; j < 
width; j++)
 
  408         for (
int j = 0; j < 
width; j++) {
 
  435     const uint16_t *lut = 
s->lut;
 
  439     for (
int plane = 0; plane < 
s->planes; plane++) {
 
  440         const int h_shift = plane ? 
s->chroma_h_shift : 0;
 
  441         int width = 
s->plane[plane].band[2][0].width;
 
  442         int a_width = 
s->plane[plane].band[2][0].a_width;
 
  443         int height = 
s->plane[plane].band[2][0].height;
 
  444         int act_plane = plane == 1 ? 2 : plane == 2 ? 1 : plane;
 
  447         int16_t *low = 
s->plane[plane].l_h[6];
 
  448         int16_t *high = 
s->plane[plane].l_h[7];
 
  450         int low_stride, high_stride;
 
  454                           in_stride, 
s->alpha);
 
  456             in_stride = avctx->
width;
 
  460                           in_stride, a_width, a_width,
 
  463         input = 
s->plane[plane].l_h[7];
 
  464         low = 
s->plane[plane].subband[7];
 
  465         low_stride = 
s->plane[plane].band[2][0].a_width;
 
  466         high = 
s->plane[plane].subband[9];
 
  467         high_stride = 
s->plane[plane].band[2][0].a_width;
 
  470                          a_width, low_stride, high_stride,
 
  473         input = 
s->plane[plane].l_h[6];
 
  474         low = 
s->plane[plane].l_h[7];
 
  475         high = 
s->plane[plane].subband[8];
 
  478                          a_width, low_stride, high_stride,
 
  481         a_width = 
s->plane[plane].band[1][0].a_width;
 
  482         width = 
s->plane[plane].band[1][0].width;
 
  483         height = 
s->plane[plane].band[1][0].height;
 
  484         input = 
s->plane[plane].l_h[7];
 
  485         low = 
s->plane[plane].l_h[3];
 
  486         low_stride = 
s->plane[plane].band[1][0].a_width;
 
  487         high = 
s->plane[plane].l_h[4];
 
  488         high_stride = 
s->plane[plane].band[1][0].a_width;
 
  490         buf = 
s->plane[plane].l_h[7];
 
  492             for (
int j = 0; j < 
width * 2; j++)
 
  498                           a_width * 2, low_stride, high_stride,
 
  501         input = 
s->plane[plane].l_h[4];
 
  502         low = 
s->plane[plane].subband[4];
 
  503         high = 
s->plane[plane].subband[6];
 
  506                          a_width, low_stride, high_stride,
 
  509         input = 
s->plane[plane].l_h[3];
 
  510         low = 
s->plane[plane].l_h[4];
 
  511         high = 
s->plane[plane].subband[5];
 
  514                          a_width, low_stride, high_stride,
 
  517         a_width = 
s->plane[plane].band[0][0].a_width;
 
  518         width = 
s->plane[plane].band[0][0].width;
 
  519         height = 
s->plane[plane].band[0][0].height;
 
  520         input = 
s->plane[plane].l_h[4];
 
  521         low = 
s->plane[plane].l_h[0];
 
  522         low_stride = 
s->plane[plane].band[0][0].a_width;
 
  523         high = 
s->plane[plane].l_h[1];
 
  524         high_stride = 
s->plane[plane].band[0][0].a_width;
 
  527             int16_t *buf = 
s->plane[plane].l_h[4];
 
  529                 for (
int j = 0; j < 
width * 2; j++)
 
  536                           a_width * 2, low_stride, high_stride,
 
  539         low = 
s->plane[plane].subband[1];
 
  540         high = 
s->plane[plane].subband[3];
 
  541         input = 
s->plane[plane].l_h[1];
 
  544                          a_width, low_stride, high_stride,
 
  547         low = 
s->plane[plane].subband[0];
 
  548         high = 
s->plane[plane].subband[2];
 
  549         input = 
s->plane[plane].l_h[0];
 
  552                          a_width, low_stride, high_stride,
 
  563     bytestream2_put_be16(pby, 9);
 
  566     bytestream2_put_be16(pby, 
s->planes);
 
  568     for (
int i = 0; 
i < 
s->planes; 
i++)
 
  569         bytestream2_put_be32(pby, 0);
 
  572     bytestream2_put_be16(pby, 0);
 
  575     bytestream2_put_be16(pby, 1);
 
  578     bytestream2_put_be16(pby, 
s->planes);
 
  584     bytestream2_put_be16(pby, 3);
 
  590     bytestream2_put_be16(pby, 2);
 
  593     bytestream2_put_be16(pby, 3);
 
  596     bytestream2_put_be16(pby, avctx->
width);
 
  602     bytestream2_put_be16(pby, avctx->
height);
 
  605     bytestream2_put_be16(pby, 
frame->
pts & 0xFFFF);
 
  614     bytestream2_put_be16(pby, 1);
 
  616     for (
int p = 0; p < 
s->planes; p++) {
 
  617         int width = 
s->plane[p].band[0][0].width;
 
  618         int a_width = 
s->plane[p].band[0][0].a_width;
 
  619         int height = 
s->plane[p].band[0][0].height;
 
  620         int16_t *
data = 
s->plane[p].subband[0];
 
  624             bytestream2_put_be16(pby, 3);
 
  627             bytestream2_put_be16(pby, p);
 
  631         bytestream2_put_be16(pby, 0x1a4a);
 
  636         bytestream2_put_be16(pby, 0);
 
  639         bytestream2_put_be16(pby, 3);
 
  642         bytestream2_put_be16(pby, 
width);
 
  645         bytestream2_put_be16(pby, 
height);
 
  648         bytestream2_put_be16(pby, 0);
 
  651         bytestream2_put_be16(pby, 1);
 
  654         bytestream2_put_be16(pby, 16);
 
  657         bytestream2_put_be16(pby, 0x0f0f);
 
  660             for (
int j = 0; j < 
width; j++)
 
  661                 bytestream2_put_be16(pby, 
data[j]);
 
  666         bytestream2_put_be16(pby, 0x1b4b);
 
  668         for (
int l = 0; l < 3; l++) {
 
  669             for (
int i = 0; 
i < 3; 
i++) {
 
  674         for (
int l = 0; l < 3; l++) {
 
  675             int a_width = 
s->plane[p].band[l][0].a_width;
 
  676             int width = 
s->plane[p].band[l][0].width;
 
  678             int height = 
s->plane[p].band[l][0].height;
 
  681             bytestream2_put_be16(pby, 0x0d0d);
 
  684             bytestream2_put_be16(pby, 3 + 2 * (l == 2));
 
  687             bytestream2_put_be16(pby, 3 - l);
 
  690             bytestream2_put_be16(pby, 3 - l);
 
  692             bytestream2_put_be16(pby, 
NumBands);
 
  693             bytestream2_put_be16(pby, 4);
 
  696             bytestream2_put_be16(pby, 
width);
 
  699             bytestream2_put_be16(pby, 
height);
 
  702             bytestream2_put_be16(pby, 0);
 
  705             bytestream2_put_be16(pby, 0);
 
  708             bytestream2_put_be16(pby, 1);
 
  711             bytestream2_put_be16(pby, 1);
 
  713             for (
int i = 0; 
i < 3; 
i++) {
 
  714                 int16_t *
data = 
s->plane[p].subband[1 + l * 3 + 
i];
 
  715                 int count = 0, padd = 0;
 
  718                 bytestream2_put_be16(pby, 0x0e0e);
 
  721                 bytestream2_put_be16(pby, 
i + 1);
 
  724                 bytestream2_put_be16(pby, 1);
 
  727                 bytestream2_put_be16(pby, 
width);
 
  730                 bytestream2_put_be16(pby, 
height);
 
  733                 bytestream2_put_be16(pby, 1 + l * 3 + 
i);
 
  736                 bytestream2_put_be16(pby, 3);
 
  739                 bytestream2_put_be16(pby, 
s->plane[p].quantization[1 + l * 3 + 
i]);
 
  742                 bytestream2_put_be16(pby, 1);
 
  745                 bytestream2_put_be16(pby, 0);
 
  748                               s->plane[p].quantization[1 + l * 3 + 
i]);
 
  752                 for (
int m = 0; m < 
height; m++) {
 
  753                     for (
int j = 0; j < 
stride; j++) {
 
  761                         } 
else if (count > 0) {
 
  780                     bytestream2_put_byte(pby, 0);
 
  783                 bytestream2_put_be16(pby, 0);
 
  787             bytestream2_put_be16(pby, 0x0c0c);
 
  794     bytestream2_put_be16(pby, 0);
 
  801     for (
int i = 0; 
i < 
s->planes; 
i++)
 
  802         bytestream2_put_be32(pby, 
s->plane[
i].size);
 
  813     for (
int i = 0; 
i < 
s->planes; 
i++) {
 
  818             s->plane[
i].subband[j] = 
NULL;
 
  820         for (
int j = 0; j < 8; j++)
 
  821             s->plane[
i].l_h[j] = 
NULL;
 
  829 #define OFFSET(x) offsetof(CFHDEncContext, x) 
  830 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM