⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jquant2.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\Obj\jquant2.o --depend=.\Obj\jquant2.d --device=DARMSTM --apcs=interwork -O3 -I..\..\include -I..\..\..\FWLib\library\inc -I..\..\..\USBLib\library\inc -I..\..\Config -I..\..\GUI\Core -I..\..\GUI\Font -I..\..\GUI\ConvertColor -I..\..\GUI\AntiAlias -I..\..\GUI\ConvertMono -I..\..\GUI\JPEG -I..\..\GUI\MemDev -I..\..\GUI\MultiLayer -I..\..\GUI\Widget -I..\..\GUI\WM -IC:\Keil\ARM\INC\ST\STM32F10x ..\..\GUI\JPEG\jquant2.c]
                          THUMB

                          AREA ||i.compute_color||, CODE, READONLY, ALIGN=2

                  compute_color PROC
;;;499    LOCAL(void)
;;;500    compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
000000  e92d4ff7          PUSH     {r0-r2,r4-r11,lr}
;;;501    /* Compute representative color for a box, put it in colormap[icolor] */
;;;502    {
000004  b085              SUB      sp,sp,#0x14
;;;503      /* Current algorithm: mean weighted by pixels (not colors) */
;;;504      /* Note it is important to get the rounding correct! */
;;;505      my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
000006  9805              LDR      r0,[sp,#0x14]
;;;506      hist3d histogram = cquantize->histogram;
;;;507      histptr histp;
;;;508      int c0,c1,c2;
;;;509      int c0min,c0max,c1min,c1max,c2min,c2max;
;;;510      long count;
;;;511      long total = 0;
000008  2300              MOVS     r3,#0
00000a  f8d001cc          LDR      r0,[r0,#0x1cc]        ;505
;;;512      long c0total = 0;
00000e  469c              MOV      r12,r3
000010  6980              LDR      r0,[r0,#0x18]         ;506
;;;513      long c1total = 0;
;;;514      long c2total = 0;
;;;515      
;;;516      c0min = boxp->c0min;  c0max = boxp->c0max;
000012  9004              STR      r0,[sp,#0x10]
;;;517      c1min = boxp->c1min;  c1max = boxp->c1max;
000014  e9d15200          LDRD     r5,r2,[r1,#0]
000018  e9d10402          LDRD     r0,r4,[r1,#8]         ;516
;;;518      c2min = boxp->c2min;  c2max = boxp->c2max;
00001c  9203              STR      r2,[sp,#0xc]
00001e  f8d1a010          LDR      r10,[r1,#0x10]        ;517
000022  9002              STR      r0,[sp,#8]
000024  6948              LDR      r0,[r1,#0x14]         ;517
;;;519      
;;;520      for (c0 = c0min; c0 <= c0max; c0++)
000026  e9cd0400          STRD     r0,r4,[sp,#0]
00002a  4698              MOV      r8,r3                 ;513
00002c  4699              MOV      r9,r3                 ;514
00002e  e027              B        |L1.128|
                  |L1.48|
;;;521        for (c1 = c1min; c1 <= c1max; c1++) {
000030  9a02              LDR      r2,[sp,#8]
000032  e021              B        |L1.120|
                  |L1.52|
;;;522          histp = & histogram[c0][c1][c2min];
000034  9904              LDR      r1,[sp,#0x10]
000036  0190              LSLS     r0,r2,#6
000038  f8511025          LDR      r1,[r1,r5,LSL #2]
00003c  eb00004a          ADD      r0,r0,r10,LSL #1
000040  1844              ADDS     r4,r0,r1
;;;523          for (c2 = c2min; c2 <= c2max; c2++) {
000042  2004              MOVS     r0,#4
;;;524    	if ((count = *histp++) != 0) {
;;;525    	  total += count;
;;;526    	  c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
000044  eb000ec5          ADD      lr,r0,r5,LSL #3
;;;527    	  c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
000048  2002              MOVS     r0,#2
00004a  4651              MOV      r1,r10                ;523
00004c  eb000b82          ADD      r11,r0,r2,LSL #2
000050  e00e              B        |L1.112|
000052  bf00              NOP                            ;524
                  |L1.84|
000054  f8340b02          LDRH     r0,[r4],#2            ;524
000058  b148              CBZ      r0,|L1.110|
;;;528    	  c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
00005a  2604              MOVS     r6,#4
00005c  eb0606c1          ADD      r6,r6,r1,LSL #3
000060  fb0ecc00          MLA      r12,lr,r0,r12         ;526
000064  fb0b8800          MLA      r8,r11,r0,r8          ;527
000068  fb069900          MLA      r9,r6,r0,r9
00006c  4403              ADD      r3,r3,r0              ;525
                  |L1.110|
00006e  1c49              ADDS     r1,r1,#1              ;523
                  |L1.112|
000070  9800              LDR      r0,[sp,#0]            ;523
000072  4281              CMP      r1,r0                 ;523
000074  ddee              BLE      |L1.84|
000076  1c52              ADDS     r2,r2,#1              ;521
                  |L1.120|
000078  9801              LDR      r0,[sp,#4]            ;521
00007a  4282              CMP      r2,r0                 ;521
00007c  ddda              BLE      |L1.52|
00007e  1c6d              ADDS     r5,r5,#1              ;520
                  |L1.128|
000080  9803              LDR      r0,[sp,#0xc]          ;520
000082  4285              CMP      r5,r0                 ;520
000084  ddd4              BLE      |L1.48|
;;;529    	}
;;;530          }
;;;531        }
;;;532      
;;;533      cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
000086  eb0c0063          ADD      r0,r12,r3,ASR #1
00008a  fb90f1f3          SDIV     r1,r0,r3
;;;534      cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
00008e  eb080263          ADD      r2,r8,r3,ASR #1
000092  fb92f4f3          SDIV     r4,r2,r3
000096  9805              LDR      r0,[sp,#0x14]         ;533
;;;535      cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);
000098  eb090663          ADD      r6,r9,r3,ASR #1
00009c  f8d05088          LDR      r5,[r0,#0x88]         ;533
0000a0  682a              LDR      r2,[r5,#0]            ;534
0000a2  4605              MOV      r5,r0                 ;534
0000a4  9807              LDR      r0,[sp,#0x1c]         ;533
0000a6  5411              STRB     r1,[r2,r0]            ;533
0000a8  f8d52088          LDR      r2,[r5,#0x88]         ;534
0000ac  fb96f1f3          SDIV     r1,r6,r3
0000b0  6852              LDR      r2,[r2,#4]            ;534
0000b2  5414              STRB     r4,[r2,r0]            ;534
0000b4  9805              LDR      r0,[sp,#0x14]
0000b6  f8d00088          LDR      r0,[r0,#0x88]
0000ba  6882              LDR      r2,[r0,#8]
0000bc  9807              LDR      r0,[sp,#0x1c]
0000be  5411              STRB     r1,[r2,r0]
;;;536    }
0000c0  b008              ADD      sp,sp,#0x20
0000c2  e8bd8ff0          POP      {r4-r11,pc}
;;;537    
                          ENDP


                          AREA ||i.fill_inverse_cmap||, CODE, READONLY, ALIGN=2

                  fill_inverse_cmap PROC
;;;855    LOCAL(void)
;;;856    fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
000000  e92d4ff0          PUSH     {r4-r11,lr}
;;;857    /* Fill the inverse-colormap entries in the update box that contains */
;;;858    /* histogram cell c0/c1/c2.  (Only that one cell MUST be filled, but */
;;;859    /* we can fill as many others as we wish.) */
;;;860    {
000004  4681              MOV      r9,r0
;;;861      my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
000006  f8d001cc          LDR      r0,[r0,#0x1cc]
;;;862      hist3d histogram = cquantize->histogram;
;;;863      int minc0, minc1, minc2;	/* lower left corner of update box */
;;;864      int ic0, ic1, ic2;
;;;865      register JSAMPLE * cptr;	/* pointer into bestcolor[] array */
;;;866      register histptr cachep;	/* pointer into main cache array */
;;;867      /* This array lists the candidate colormap indexes. */
;;;868      JSAMPLE colorlist[MAXNUMCOLORS];
;;;869      int numcolors;		/* number of candidate colors */
;;;870      /* This array holds the actually closest colormap index for each cell. */
;;;871      JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
;;;872    
;;;873      /* Convert cell coordinates to update box ID */
;;;874      c0 >>= BOX_C0_LOG;
00000a  108d              ASRS     r5,r1,#2
;;;875      c1 >>= BOX_C1_LOG;
;;;876      c2 >>= BOX_C2_LOG;
;;;877    
;;;878      /* Compute true coordinates of update box's origin corner.
;;;879       * Actually we compute the coordinates of the center of the corner
;;;880       * histogram cell, which are the lower bounds of the volume we care about.
;;;881       */
;;;882      minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
00000c  f8d08018          LDR      r8,[r0,#0x18]
000010  109c              ASRS     r4,r3,#2              ;876
000012  2004              MOVS     r0,#4
000014  b0e3              SUB      sp,sp,#0x18c          ;860
000016  10d6              ASRS     r6,r2,#3              ;875
;;;883      minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
000018  2102              MOVS     r1,#2
00001a  eb001745          ADD      r7,r0,r5,LSL #5       ;882
00001e  eb011b46          ADD      r11,r1,r6,LSL #5
;;;884      minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
000022  eb001a44          ADD      r10,r0,r4,LSL #5
;;;885      
;;;886      /* Determine which colormap entries are close enough to be candidates
;;;887       * for the nearest entry to some cell in the update box.
;;;888       */
;;;889      numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);
000026  ab23              ADD      r3,sp,#0x8c
000028  9300              STR      r3,[sp,#0]
00002a  4653              MOV      r3,r10
00002c  465a              MOV      r2,r11
00002e  4639              MOV      r1,r7
000030  4648              MOV      r0,r9
000032  f7fffffe          BL       find_nearby_colors
;;;890    
;;;891      /* Determine the actually nearest colors. */
;;;892      find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
000036  ab03              ADD      r3,sp,#0xc
000038  aa23              ADD      r2,sp,#0x8c
00003a  e88d000d          STM      sp,{r0,r2,r3}
00003e  4653              MOV      r3,r10
000040  465a              MOV      r2,r11
000042  4639              MOV      r1,r7
000044  4648              MOV      r0,r9
000046  f7fffffe          BL       find_best_colors
;;;893    		   bestcolor);
;;;894    
;;;895      /* Save the best color numbers (plus 1) in the main cache array */
;;;896      c0 <<= BOX_C0_LOG;		/* convert ID back to base cell indexes */
;;;897      c1 <<= BOX_C1_LOG;
;;;898      c2 <<= BOX_C2_LOG;
00004a  ea4f0c84          LSL      r12,r4,#2
00004e  ea4f0985          LSL      r9,r5,#2              ;892
000052  ea4f0ec6          LSL      lr,r6,#3              ;892
;;;899      cptr = bestcolor;
000056  ab03              ADD      r3,sp,#0xc
;;;900      for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
000058  2400              MOVS     r4,#0
                  |L2.90|
;;;901        for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
00005a  2200              MOVS     r2,#0
;;;902          cachep = & histogram[c0+ic0][c1+ic1][c2];
00005c  eb090604          ADD      r6,r9,r4
                  |L2.96|
000060  eb0e0002          ADD      r0,lr,r2
000064  0180              LSLS     r0,r0,#6
000066  f8581026          LDR      r1,[r8,r6,LSL #2]
00006a  eb00004c          ADD      r0,r0,r12,LSL #1
00006e  4401              ADD      r1,r1,r0
;;;903          for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
000070  f05f0000          MOVS.W   r0,#0
                  |L2.116|
;;;904    	*cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1);
000074  f8135b01          LDRB     r5,[r3],#1
000078  1c8f              ADDS     r7,r1,#2
00007a  1c6d              ADDS     r5,r5,#1
00007c  800d              STRH     r5,[r1,#0]
00007e  1c40              ADDS     r0,r0,#1              ;903
000080  4639              MOV      r1,r7
000082  2804              CMP      r0,#4                 ;903
000084  dbf6              BLT      |L2.116|
000086  1c52              ADDS     r2,r2,#1              ;901
000088  2a08              CMP      r2,#8                 ;901
00008a  dbe9              BLT      |L2.96|
00008c  1c64              ADDS     r4,r4,#1              ;900
00008e  2c04              CMP      r4,#4                 ;900
000090  dbe3              BLT      |L2.90|
;;;905          }
;;;906        }
;;;907      }
;;;908    }
000092  b063              ADD      sp,sp,#0x18c
000094  e8bd8ff0          POP      {r4-r11,pc}
;;;909    
                          ENDP


                          AREA ||i.find_best_colors||, CODE, READONLY, ALIGN=1

                  find_best_colors PROC
;;;775    LOCAL(void)
;;;776    find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
000000  e92d4fff          PUSH     {r0-r11,lr}
;;;777    		  int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
;;;778    /* Find the closest colormap entry for each cell in the update box,
;;;779     * given the list of candidate colors prepared by find_nearby_colors.
;;;780     * Return the indexes of the closest entries in the bestcolor[] array.
;;;781     * This routine uses Thomas' incremental distance calculation method to
;;;782     * find the distance from a colormap entry to successive cells in the box.
;;;783     */
;;;784    {
000004  f5ad7d03          SUB      sp,sp,#0x20c
;;;785      int ic0, ic1, ic2;
;;;786      int i, icolor;
;;;787      register INT32 * bptr;	/* pointer into bestdist[] array */
;;;788      JSAMPLE * cptr;		/* pointer into bestcolor[] array */
;;;789      INT32 dist0, dist1;		/* initial distance values */
;;;790      register INT32 dist2;		/* current distance in inner loop */
;;;791      INT32 xx0, xx1;		/* distance increments */
;;;792      register INT32 xx2;
;;;793      INT32 inc0, inc1, inc2;	/* initial values for increments */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -