Subversion Repositories Kolibri OS

Rev

Rev 7105 | Rev 8449 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;================================================================================================;;
  2. ;;//// convert.asm //// (c) dunkaist, 2012 ///////////////////////////////////////////////////////;;
  3. ;;================================================================================================;;
  4. ;;                                                                                                ;;
  5. ;; This file is part of Common development libraries (Libs-Dev).                                  ;;
  6. ;;                                                                                                ;;
  7. ;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
  8. ;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
  9. ;; of the License, or (at your option) any later version.                                         ;;
  10. ;;                                                                                                ;;
  11. ;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
  12. ;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
  13. ;; Lesser General Public License for more details.                                                ;;
  14. ;;                                                                                                ;;
  15. ;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
  16. ;; If not, see <http://www.gnu.org/licenses/>.                                                    ;;
  17. ;;                                                                                                ;;
  18. ;;================================================================================================;;
  19.  
  20.  
  21.  
  22. ;;================================================================================================;;
  23. proc img.convert _src, _dst, _dst_type, _flags, _param                                            ;;
  24. ;;------------------------------------------------------------------------------------------------;;
  25. ;? convert _image                                                                                 ;;
  26. ;;------------------------------------------------------------------------------------------------;;
  27. ;> [_src]      = pointer to source image                                                          ;;
  28. ;> [_dst]      = pointer to destination image, or 0 to create a new one                           ;;
  29. ;> [_dst_type] = Image.Type of resulting image                                                    ;;
  30. ;> [_flags]    = see libimg.inc                                                                   ;;
  31. ;> [_param]    = depends on _flags fields, see libimg.inc                                         ;;
  32. ;;------------------------------------------------------------------------------------------------;;
  33. ;< eax = 0 / pointer to converted image                                                           ;;
  34. ;< ecx = error code / undefined                                                                   ;;
  35. ;;================================================================================================;;
  36. locals
  37.         img     dd ?
  38.         prev    dd ?
  39. endl
  40.         push    ebx esi edi
  41.         mov     [img], 0
  42.         mov     [prev], 0
  43.         mov     ebx, [_src]
  44.     @@:
  45.         mov     eax, [ebx + Image.Previous]
  46.         test    eax, eax
  47.         jz      .loop
  48.         mov     ebx, eax
  49.         jmp     @b
  50.   .loop:
  51.         stdcall img.convert.layer, ebx, [_dst], [_dst_type], [_flags], [_param]
  52.         test    eax, eax
  53.         jz      .error
  54.         cmp     [img], 0
  55.         jnz     @f
  56.         mov     [img], eax
  57.     @@:
  58.         mov     ecx, [prev]
  59.         jecxz   @f
  60.         mov     [ecx + Image.Next], eax
  61.         mov     [eax + Image.Previous], ecx
  62.     @@:
  63.         mov     [prev], eax
  64.         push    [ebx + Image.Flags]
  65.         pop     [eax + Image.Flags]
  66.         push    [ebx + Image.Delay]
  67.         pop     [eax + Image.Delay]
  68.         mov     ebx, [ebx + Image.Next]
  69.         test    ebx, ebx
  70.         jnz     .loop
  71.         mov     eax, [img]
  72.   .error:
  73.         pop     edi esi ebx
  74.         ret
  75. endp
  76.  
  77.  
  78. ;;================================================================================================;;
  79. proc img.convert.layer _src, _dst, _dst_type, _flags, _param                                      ;;
  80. ;;------------------------------------------------------------------------------------------------;;
  81. ;? convert _image layer                                                                           ;;
  82. ;;------------------------------------------------------------------------------------------------;;
  83. ;> [_src]      = pointer to source image                                                          ;;
  84. ;> [_dst]      = pointer to destination image, or 0 to create a new one                           ;;
  85. ;> [_dst_type] = Image.Type of resulting image                                                    ;;
  86. ;> [_flags]    = see libimg.inc                                                                   ;;
  87. ;> [_param]    = depends on _flags fields, see libimg.inc                                         ;;
  88. ;;------------------------------------------------------------------------------------------------;;
  89. ;< eax = 0 / pointer to converted image                                                           ;;
  90. ;< ecx = error code / undefined                                                                   ;;
  91. ;;================================================================================================;;
  92. locals
  93.         fun     rd 1
  94. endl
  95.         push    ebx esi edi
  96.  
  97.         mov     ebx, [_src]
  98.         mov     eax, [ebx + Image.Type]
  99.         mov     esi, [img.convert.table + 4*eax]
  100.   .next:
  101.         lodsd
  102.         test    eax, eax
  103.         jnz     @f
  104.         mov     ecx, LIBIMG_ERROR_BIT_DEPTH
  105.         jmp     .exit
  106.     @@:
  107.         cmp     eax, [_dst_type]
  108.         lodsd
  109.         jnz     .next
  110.         mov     [fun], eax
  111.  
  112.         mov     eax, [_dst]
  113.         test    eax, eax
  114.         jnz     @f
  115.         stdcall img.create, [ebx + Image.Width], [ebx + Image.Height], [_dst_type]
  116.         test    eax, eax
  117.         jz      .exit
  118.         mov     [_dst], eax
  119.     @@:
  120.         mov     edi, [eax + Image.Data]
  121.         mov     esi, [ebx + Image.Data]
  122.         mov     eax, [ebx + Image.Type]
  123.         stdcall [fun], [_src], [_dst]
  124.         mov     eax, [_dst]
  125.   .exit:
  126.         pop     edi esi ebx
  127.         ret
  128. endp
  129.  
  130. proc img._.convert.bpp8i_to_bpp24 _src, _dst
  131.         mov     ecx, [ebx + Image.Width]
  132.         imul    ecx, [ebx + Image.Height]
  133.  
  134.         mov     ebx, [ebx + Image.Palette]
  135.         sub     ecx, 1
  136.         jz      .bpp8i.last
  137.     @@:
  138.         movzx   eax, byte[esi]
  139.         add     esi, 1
  140.         mov     eax, [ebx + eax*4]
  141.         mov     [edi], eax
  142.         add     edi, 3
  143.         sub     ecx, 1
  144.         jnz     @b
  145.   .bpp8i.last:
  146.         movzx   eax, byte[esi]
  147.         mov     eax, [ebx + eax*4]
  148.         mov     [edi], ax
  149.         shr     eax, 16
  150.         mov     [edi + 2], al
  151.         ret
  152. endp
  153.  
  154.  
  155. proc img._.convert.bpp8i_to_bpp32 _src, _dst
  156.         mov     ecx, [ebx + Image.Width]
  157.         imul    ecx, [ebx + Image.Height]
  158.  
  159.         mov     ebx, [ebx + Image.Palette]
  160.     @@:
  161.         movzx   eax, byte[esi]
  162.         add     esi, 1
  163.         mov     eax, [ebx + eax*4]
  164.         mov     [edi], eax
  165.         add     edi, 4
  166.         dec     ecx
  167.         jnz     @b
  168.         ret
  169. endp
  170.  
  171.  
  172. proc img._.convert.bpp8g_to_bpp1 _src, _dst
  173.         mov     eax, [_dst]
  174.         mov     eax, [eax + Image.Palette]
  175.         mov     dword[eax], 0x00000000
  176.         mov     dword[eax + 4], 0xffffffff
  177.         mov     edx, [ebx + Image.Height]
  178.   .bpp8g_to_bpp1.line:
  179.         mov     ax, 0x0800
  180.         mov     ecx, [ebx + Image.Width]
  181.   .bpp8g_to_bpp1.pixel:
  182.         shl     al, 1
  183.         cmp     byte[esi], 0x7f
  184.         cmc
  185.         adc     eax, 0
  186.         add     esi, 1
  187.         dec     ah
  188.         jnz     @f
  189.         mov     byte[edi], al
  190.         add     edi, 1
  191.         mov     ax, 0x0800
  192.     @@:
  193.         dec     ecx
  194.         jnz     .bpp8g_to_bpp1.pixel
  195.         cmp     ah, 8
  196.         je      @f
  197.         mov     cl, ah
  198.         shl     al, cl
  199.         mov     byte[edi], al
  200.         add     edi, 1
  201.     @@:
  202.         dec     edx
  203.         jnz     .bpp8g_to_bpp1.line
  204.         ret
  205. endp
  206.  
  207. proc img._.convert.bpp8g_to_bpp24 _src, _dst
  208.         mov     ecx, [ebx + Image.Width]
  209.         imul    ecx, [ebx + Image.Height]
  210.     @@:
  211.         mov     al, byte[esi]
  212.         mov     byte[edi + 0], al
  213.         mov     byte[edi + 1], al
  214.         mov     byte[edi + 2], al
  215.         add     esi, 1
  216.         add     edi, 3
  217.         sub     ecx, 1
  218.         jnz     @b
  219.         ret
  220. endp
  221.  
  222.  
  223. proc img._.convert.bpp24_to_bpp24 _src, _dst
  224.         mov     ecx, [ebx + Image.Width]
  225.         imul    ecx, [ebx + Image.Height]
  226.         lea     ecx, [ecx*3]
  227.         mov     edx, ecx
  228.         shr     ecx, 2
  229.         rep     movsd
  230.         mov     ecx, edx
  231.         and     ecx, 3
  232.         rep     movsb
  233.         ret
  234. endp
  235.  
  236.  
  237. proc img._.convert.bpp24_to_bpp8g _src, _dst
  238.         mov     ecx, [ebx + Image.Width]
  239.         imul    ecx, [ebx + Image.Height]
  240.     @@:
  241.         movzx   ebx, byte[esi + 0]
  242.         movzx   eax, byte[esi + 1]
  243.         add     ebx, eax
  244.         movzx   eax, byte[esi + 2]
  245.         add     eax, ebx
  246.         mov     ebx, 3
  247.         add     esi, 3
  248.         div     bl
  249.         mov     byte[edi], al
  250.         add     edi, 1
  251.         sub     ecx, 1
  252.         jnz     @b
  253.         ret
  254. endp
  255.  
  256.  
  257. proc img._.convert.bpp24_to_bpp32 _src, _dst
  258.         mov     ecx, [ebx + Image.Width]
  259.         imul    ecx, [ebx + Image.Height]
  260.     @@:
  261.         lodsw
  262.         ror     eax, 16
  263.         lodsb
  264.         mov     ah, 0xff        ; opaque
  265.         rol     eax, 16
  266.         stosd
  267.         dec     ecx
  268.         jnz     @b
  269.         ret
  270. endp
  271.  
  272.  
  273. proc img._.convert.bpp32_to_bpp24 _src, _dst
  274.         mov     ecx, [ebx + Image.Width]
  275.         imul    ecx, [ebx + Image.Height]
  276.     @@:
  277.         mov     eax, [esi]
  278.         mov     [edi], ax
  279.         shr     eax, 16
  280.         mov     [edi + 2], al
  281.         add     esi, 4
  282.         add     edi, 3
  283.         sub     ecx, 1
  284.         jnz     @b
  285.         ret
  286. endp
  287.  
  288.  
  289. proc img._.convert.bpp32_to_bpp32 _src, _dst
  290.         mov     ecx, [ebx + Image.Width]
  291.         imul    ecx, [ebx + Image.Height]
  292.         rep     movsd
  293.         ret
  294. endp
  295.  
  296.  
  297. proc img._.convert.bpp15_to_bpp24 _src, _dst
  298.         mov     ecx, [ebx + Image.Width]
  299.         imul    ecx, [ebx + Image.Height]
  300.  
  301.   .bpp15.intel: ; copypasted from do_rgb
  302.         push    ebx ebp
  303.         sub     ecx, 4
  304.         jb      .bpp15.tail
  305. align 16
  306.   .bpp15.intel.loop:
  307. repeat 2
  308.         mov     ebx, [esi]
  309.         mov     al, [esi]
  310.         mov     ah, [esi + 1]
  311.         add     esi, 4
  312.         and     al, 0x1F
  313.         and     ah, 0x1F shl 2
  314.         mov     ebp, ebx
  315.         mov     dl, al
  316.         mov     dh, ah
  317.         shr     al, 2
  318.         shr     ah, 4
  319.         shl     dl, 3
  320.         shl     dh, 1
  321.         and     ebp, 0x1F shl 5
  322.         add     al, dl
  323.         add     ah, dh
  324.         shr     ebp, 2
  325.         mov     [edi], al
  326.         mov     [edi + 2], ah
  327.         mov     eax, ebx
  328.         mov     ebx, ebp
  329.         shr     eax, 16
  330.         shr     ebx, 5
  331.         add     ebx, ebp
  332.         mov     ebp, eax
  333.         mov     [edi + 1], bl
  334.         and     eax, (0x1F) or (0x1F shl 10)
  335.         and     ebp, 0x1F shl 5
  336.         lea     edx, [eax + eax]
  337.         shr     al, 2
  338.         mov     ebx, ebp
  339.         shr     ah, 4
  340.         shl     dl, 2
  341.         shr     ebx, 2
  342.         shr     ebp, 7
  343.         add     al, dl
  344.         add     ah, dh
  345.         mov     [edi + 3], al
  346.         add     ebx, ebp
  347.         mov     [edi + 5], ah
  348.         mov     [edi + 4], bl
  349.         add     edi, 6
  350. end repeat
  351.         sub     ecx, 4
  352.         jnb     .bpp15.intel.loop
  353.   .bpp15.tail:
  354.         add     ecx, 4
  355.         jz      .bpp15.done
  356.     @@:
  357.         movzx   eax, word [esi]
  358.         mov     ebx, eax
  359.         add     esi, 2
  360.         and     eax, (0x1F) or (0x1F shl 10)
  361.         and     ebx, 0x1F shl 5
  362.         lea     edx, [eax + eax]
  363.         shr     al, 2
  364.         mov     ebp, ebx
  365.         shr     ebx, 2
  366.         shr     ah, 4
  367.         shl     dl, 2
  368.         shr     ebp, 7
  369.         add     eax, edx
  370.         add     ebx, ebp
  371.         mov     [edi], al
  372.         mov     [edi + 1], bl
  373.         mov     [edi + 2], ah
  374.         add     edi, 3
  375.         sub     ecx, 1
  376.         jnz     @b
  377.   .bpp15.done:
  378.         pop     ebp ebx
  379.         mov     eax, [_dst]
  380.         jmp     .quit
  381.  
  382.   .bpp15.amd:
  383.         push    ebx ebp
  384.         sub     ecx, 4
  385.         jb      .bpp15.tail
  386. align 16
  387.   .bpp15.amd.loop:
  388. repeat 4
  389. if (% mod 2) = 1
  390.         mov     eax, dword[esi]
  391.         mov     ebx, dword[esi]
  392. else
  393.         movzx   eax, word[esi]
  394.         mov     ebx, eax
  395. end if
  396.         add     esi, 2
  397.         and     eax, (0x1F) or (0x1F shl 10)
  398.         and     ebx, 0x1F shl 5
  399.         lea     edx, [eax + eax]
  400.         shr     al, 2
  401.         mov     ebp, ebx
  402.         shr     ebx, 2
  403.         shr     ah, 4
  404.         shl     dl, 2
  405.         shr     ebp, 7
  406.         add     eax, edx
  407.         add     ebx, ebp
  408.         mov     [edi], al
  409.         mov     [edi + 1], bl
  410.         mov     [edi + 2], ah
  411.         add     edi, 3
  412. end repeat
  413.         sub     ecx, 4
  414.         jnb     .bpp15.amd.loop
  415.         jmp     .bpp15.tail
  416.  
  417.   .quit:
  418.         ret
  419. endp
  420.  
  421.  
  422. proc img._.convert.bpp16_to_bpp24 _src, _dst
  423.         mov     ecx, [ebx + Image.Width]
  424.         imul    ecx, [ebx + Image.Height]
  425.   .bpp16.intel:
  426.         push    ebx ebp
  427.         sub     ecx, 4
  428.         jb      .bpp16.tail
  429. align 16
  430.   .bpp16.intel.loop:
  431. repeat 2
  432.         mov     ebx, [esi]
  433.         mov     al, [esi]
  434.         mov     ah, [esi + 1]
  435.         add     esi, 4
  436.         and     al, 0x1F
  437.         and     ah, 0x1F shl 3
  438.         mov     ebp, ebx
  439.         mov     dl, al
  440.         mov     dh, ah
  441.         shr     al, 2
  442.         shr     ah, 5
  443.         shl     dl, 3
  444.         and     ebp, 0x3F shl 5
  445.         add     al, dl
  446.         add     ah, dh
  447.         shr     ebp, 3
  448.         mov     [edi], al
  449.         mov     [edi + 2], ah
  450.         mov     eax, ebx
  451.         mov     ebx, ebp
  452.         shr     eax, 16
  453.         shr     ebx, 6
  454.         add     ebx, ebp
  455.         mov     ebp, eax
  456.         mov     [edi + 1], bl
  457.         and     eax, (0x1F) or (0x1F shl 11)
  458.         and     ebp, 0x3F shl 5
  459.         mov     edx, eax
  460.         shr     al, 2
  461.         mov     ebx, ebp
  462.         shr     ah, 5
  463.         shl     dl, 3
  464.         shr     ebx, 3
  465.         shr     ebp, 9
  466.         add     al, dl
  467.         add     ah, dh
  468.         mov     [edi + 3], al
  469.         add     ebx, ebp
  470.         mov     [edi + 5], ah
  471.         mov     [edi + 4], bl
  472.         add     edi, 6
  473. end repeat
  474.         sub     ecx, 4
  475.         jnb     .bpp16.intel.loop
  476.   .bpp16.tail:
  477.         add     ecx, 4
  478.         jz      .bpp16.done
  479.     @@:
  480.         movzx   eax, word[esi]
  481.         mov     ebx, eax
  482.         add     esi, 2
  483.         and     eax, (0x1F) or (0x1F shl 11)
  484.         and     ebx, 0x3F shl 5
  485.         mov     edx, eax
  486.         shr     al, 2
  487.         mov     ebp, ebx
  488.         shr     ebx, 3
  489.         shr     ah, 5
  490.         shl     dl, 3
  491.         shr     ebp, 9
  492.         add     eax, edx
  493.         add     ebx, ebp
  494.         mov     [edi], al
  495.         mov     [edi + 1], bl
  496.         mov     [edi + 2], ah
  497.         add     edi, 3
  498.         sub     ecx, 1
  499.         jnz     @b
  500.   .bpp16.done:
  501.         pop     ebp ebx
  502.         mov     eax, [_dst]
  503.         jmp     .quit
  504.  
  505.   .bpp16.amd:
  506.         push    ebx ebp
  507.         sub     ecx, 4
  508.         jb      .bpp16.tail
  509. align 16
  510.   .bpp16.amd.loop:
  511. repeat 4
  512. if (% mod 2) = 1
  513.         mov     eax, dword[esi]
  514.         mov     ebx, dword[esi]
  515. else
  516.         movzx   eax, word[esi]
  517.         mov     ebx, eax
  518. end if
  519.         add     esi, 2
  520.         and     eax, (0x1F) or (0x1F shl 11)
  521.         and     ebx, 0x3F shl 5
  522.         mov     edx, eax
  523.         shr     al, 2
  524.         mov     ebp, ebx
  525.         shr     ebx, 3
  526.         shr     ah, 5
  527.         shl     dl, 3
  528.         shr     ebp, 9
  529.         add     eax, edx
  530.         add     ebx, ebp
  531.         mov     [edi], al
  532.         mov     [edi + 1], bl
  533.         mov     [edi + 2], ah
  534.         add     edi, 3
  535. end repeat
  536.         sub     ecx, 4
  537.         jnb     .bpp16.amd.loop
  538.         jmp     .bpp16.tail
  539.  
  540.   .quit:
  541.         ret
  542. endp
  543.  
  544.  
  545. proc img._.convert.bpp1_to_bpp24 _src, _dst
  546. locals
  547.         width   rd 1
  548.         height  rd 1
  549. endl
  550.         push    [ebx + Image.Width]
  551.         pop     [width]
  552.         push    [ebx + Image.Height]
  553.         pop     [height]
  554.         mov     edx, [ebx + Image.Palette]
  555.   .bpp1_to_bpp24.line:
  556.         mov     ebx, [width]
  557.   .bpp1_to_bpp24.byte:
  558.         mov     ah, 8
  559.         mov     al, byte[esi]
  560.         add     esi, 1
  561.   .bpp1_to_bpp24.bit:
  562.         xor     ecx, ecx
  563.         shl     al, 1
  564.         adc     ecx, 0
  565.         mov     ecx, [edx + 4*ecx]
  566.         mov     word[edi], cx
  567.         shr     ecx, 8
  568.         mov     byte[edi + 2], ch
  569.         add     edi, 3
  570.         sub     ebx, 1
  571.         jnz     @f
  572.         sub     [height], 1
  573.         jnz     .bpp1_to_bpp24.line
  574.         jmp     .bpp1.done
  575.     @@:
  576.         sub     ah, 1
  577.         jnz     .bpp1_to_bpp24.bit
  578.         jmp     .bpp1_to_bpp24.byte
  579.   .bpp1.done:
  580.         ret
  581. endp
  582.  
  583.  
  584. proc img._.convert.bpp8a_to_bpp1 _src, _dst
  585.         mov     eax, [_dst]
  586.         mov     eax, [eax + Image.Palette]
  587.         mov     dword[eax], 0x00000000
  588.         mov     dword[eax + 4], 0xffffffff
  589.         mov     edx, [ebx + Image.Height]
  590.   .bpp8a_to_bpp1.line:
  591.         mov     ax, 0x0800
  592.         mov     ecx, [ebx + Image.Width]
  593.   .bpp8a_to_bpp1.pixel:
  594.         shl     al, 1
  595.         cmp     byte[esi], 0x7f
  596.         cmc
  597.         adc     eax, 0
  598.         add     esi, 2
  599.         dec     ah
  600.         jnz     @f
  601.         mov     byte[edi], al
  602.         add     edi, 1
  603.         mov     ax, 0x0800
  604.     @@:
  605.         dec     ecx
  606.         jnz     .bpp8a_to_bpp1.pixel
  607.         cmp     ah, 8
  608.         je      @f
  609.         mov     cl, ah
  610.         shl     al, cl
  611.         mov     byte[edi], al
  612.         add     edi, 1
  613.     @@:
  614.         dec     edx
  615.         jnz     .bpp8a_to_bpp1.line
  616.         ret
  617. endp
  618.  
  619.  
  620. proc img._.convert.bpp8a_to_bpp24 _src, _dst
  621.         mov     ecx, [ebx + Image.Width]
  622.         imul    ecx, [ebx + Image.Height]
  623.     @@:
  624.         mov     al, byte[esi]
  625.         mov     byte[edi + 0], al
  626.         mov     byte[edi + 1], al
  627.         mov     byte[edi + 2], al
  628.         add     esi, 2
  629.         add     edi, 3
  630.         sub     ecx, 1
  631.         jnz     @b
  632.         ret
  633. endp
  634.  
  635.  
  636. img.convert.bpp8i.table:
  637.         dd Image.bpp24, img._.convert.bpp8i_to_bpp24
  638.         dd Image.bpp32, img._.convert.bpp8i_to_bpp32
  639.         dd 0
  640. img.convert.bpp24.table:
  641.         dd Image.bpp24, img._.convert.bpp24_to_bpp24
  642.         dd Image.bpp8g, img._.convert.bpp24_to_bpp8g
  643.         dd Image.bpp32, img._.convert.bpp24_to_bpp32
  644.         dd 0
  645. img.convert.bpp32.table:
  646.         dd Image.bpp24, img._.convert.bpp32_to_bpp24
  647.         dd Image.bpp32, img._.convert.bpp32_to_bpp32
  648.         dd 0
  649. img.convert.bpp15.table:
  650.         dd Image.bpp24, img._.convert.bpp15_to_bpp24
  651.         dd 0
  652. img.convert.bpp16.table:
  653.         dd Image.bpp24, img._.convert.bpp16_to_bpp24
  654.         dd 0
  655. img.convert.bpp1.table:
  656.         dd Image.bpp24, img._.convert.bpp1_to_bpp24
  657.         dd 0
  658. img.convert.bpp8g.table:
  659.         dd Image.bpp24, img._.convert.bpp8g_to_bpp24
  660.         dd Image.bpp1,  img._.convert.bpp8g_to_bpp1
  661.         dd 0
  662. img.convert.bpp2i.table:
  663.         dd 0
  664. img.convert.bpp4i.table:
  665.         dd 0
  666. img.convert.bpp8a.table:
  667.         dd Image.bpp24, img._.convert.bpp8a_to_bpp24
  668.         dd 0
  669.  
  670. img.convert.table:
  671.         dd 0    ; no image type zero
  672.         dd img.convert.bpp8i.table
  673.         dd img.convert.bpp24.table
  674.         dd img.convert.bpp32.table
  675.         dd img.convert.bpp15.table
  676.         dd img.convert.bpp16.table
  677.         dd img.convert.bpp1.table
  678.         dd img.convert.bpp8g.table
  679.         dd img.convert.bpp2i.table
  680.         dd img.convert.bpp4i.table
  681.         dd img.convert.bpp8a.table
  682.