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

📄 jquant1.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;609      }
;;;610    }
00009c  b008              ADD      sp,sp,#0x20
00009e  e8bd8ff0          POP      {r4-r11,pc}
;;;611    
                          ENDP


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

                  quantize_fs_dither PROC
;;;613    METHODDEF(void)
;;;614    quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
000000  e92d4fff          PUSH     {r0-r11,lr}
;;;615    		    JSAMPARRAY output_buf, int num_rows)
;;;616    /* General case, with Floyd-Steinberg dithering */
;;;617    {
;;;618      my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
;;;619      register LOCFSERROR cur;	/* current error or pixel value */
;;;620      LOCFSERROR belowerr;		/* error for pixel below cur */
;;;621      LOCFSERROR bpreverr;		/* error for below/prev col */
;;;622      LOCFSERROR bnexterr;		/* error for below/next col */
;;;623      LOCFSERROR delta;
;;;624      register FSERRPTR errorptr;	/* => fserrors[] at column before current */
;;;625      register JSAMPROW input_ptr;
;;;626      register JSAMPROW output_ptr;
;;;627      JSAMPROW colorindex_ci;
;;;628      JSAMPROW colormap_ci;
;;;629      int pixcode;
;;;630      int nc = cinfo->out_color_components;
;;;631      int dir;			/* 1 for left-to-right, -1 for right-to-left */
;;;632      int dirnc;			/* dir * nc */
;;;633      int ci;
;;;634      int row;
;;;635      JDIMENSION col;
;;;636      JDIMENSION width = cinfo->output_width;
;;;637      JSAMPLE *range_limit = cinfo->sample_range_limit;
000004  f8d0b070          LDR      r11,[r0,#0x70]
000008  f8d071cc          LDR      r7,[r0,#0x1cc]
00000c  6f82              LDR      r2,[r0,#0x78]
00000e  b087              SUB      sp,sp,#0x1c           ;617
000010  f8d00144          LDR      r0,[r0,#0x144]
;;;638      SHIFT_TEMPS
;;;639    
;;;640      for (row = 0; row < num_rows; row++) {
000014  f04f0900          MOV      r9,#0
000018  9203              STR      r2,[sp,#0xc]
00001a  9001              STR      r0,[sp,#4]
00001c  e06d              B        |L12.250|
                  |L12.30|
;;;641        /* Initialize output values to 0 so can process components separately */
;;;642        jzero_far((void FAR *) output_buf[row],
00001e  9809              LDR      r0,[sp,#0x24]
000020  4659              MOV      r1,r11
000022  f8500029          LDR      r0,[r0,r9,LSL #2]
000026  f7fffffe          BL       jzero_far
;;;643    	      (size_t) (width * SIZEOF(JSAMPLE)));
;;;644        for (ci = 0; ci < nc; ci++) {
00002a  2000              MOVS     r0,#0
00002c  e05b              B        |L12.230|
                  |L12.46|
;;;645          input_ptr = input_buf[row] + ci;
00002e  9908              LDR      r1,[sp,#0x20]
000030  f8511029          LDR      r1,[r1,r9,LSL #2]
000034  180b              ADDS     r3,r1,r0
;;;646          output_ptr = output_buf[row];
000036  9909              LDR      r1,[sp,#0x24]
000038  f8512029          LDR      r2,[r1,r9,LSL #2]
;;;647          if (cquantize->on_odd_row) {
00003c  6d79              LDR      r1,[r7,#0x54]
00003e  b191              CBZ      r1,|L12.102|
;;;648    	/* work right to left in this row */
;;;649    	input_ptr += (width-1) * nc; /* so point to rightmost pixel */
000040  9c03              LDR      r4,[sp,#0xc]
000042  f1ab0101          SUB      r1,r11,#1
000046  fb013304          MLA      r3,r1,r4,r3
;;;650    	output_ptr += width-1;
00004a  445a              ADD      r2,r2,r11
00004c  1e52              SUBS     r2,r2,#1
;;;651    	dir = -1;
;;;652    	dirnc = -nc;
00004e  4261              RSBS     r1,r4,#0
;;;653    	errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */
000050  9102              STR      r1,[sp,#8]
000052  eb070180          ADD      r1,r7,r0,LSL #2
000056  6c4c              LDR      r4,[r1,#0x44]
000058  2102              MOVS     r1,#2
00005a  eb01014b          ADD      r1,r1,r11,LSL #1
00005e  f04f38ff          MOV      r8,#0xffffffff        ;651
000062  4421              ADD      r1,r1,r4
000064  e006              B        |L12.116|
                  |L12.102|
;;;654          } else {
;;;655    	/* work left to right in this row */
;;;656    	dir = 1;
;;;657    	dirnc = nc;
000066  9903              LDR      r1,[sp,#0xc]
;;;658    	errorptr = cquantize->fserrors[ci]; /* => entry before first column */
000068  9102              STR      r1,[sp,#8]
00006a  eb070180          ADD      r1,r7,r0,LSL #2
00006e  6c49              LDR      r1,[r1,#0x44]
000070  f04f0801          MOV      r8,#1                 ;656
                  |L12.116|
;;;659          }
;;;660          colorindex_ci = cquantize->colorindex[ci];
000074  69bc              LDR      r4,[r7,#0x18]
000076  693d              LDR      r5,[r7,#0x10]
000078  f8544020          LDR      r4,[r4,r0,LSL #2]
;;;661          colormap_ci = cquantize->sv_colormap[ci];
;;;662          /* Preset error values: no error propagated to first pixel from left */
;;;663          cur = 0;
00007c  2600              MOVS     r6,#0
00007e  9405              STR      r4,[sp,#0x14]         ;661
000080  f8554020          LDR      r4,[r5,r0,LSL #2]     ;661
;;;664          /* and no error propagated to row below yet */
;;;665          belowerr = bpreverr = 0;
000084  46b2              MOV      r10,r6
;;;666    
;;;667          for (col = width; col > 0; col--) {
000086  9606              STR      r6,[sp,#0x18]
000088  9404              STR      r4,[sp,#0x10]
00008a  ea5f0c0b          MOVS     r12,r11
00008e  d027              BEQ      |L12.224|
                  |L12.144|
;;;668    	/* cur holds the error propagated from the previous pixel on the
;;;669    	 * current line.  Add the error propagated from the previous line
;;;670    	 * to form the complete error correction term for this pixel, and
;;;671    	 * round the error term (which is expressed * 16) to an integer.
;;;672    	 * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
;;;673    	 * for either sign of the error value.
;;;674    	 * Note: errorptr points to *previous* column's array entry.
;;;675    	 */
;;;676    	cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4);
000090  f9314018          LDRSH    r4,[r1,r8,LSL #1]
000094  3608              ADDS     r6,r6,#8
000096  4434              ADD      r4,r4,r6
000098  1125              ASRS     r5,r4,#4
;;;677    	/* Form pixel value + error, and range-limit to 0..MAXJSAMPLE.
;;;678    	 * The maximum error is +- MAXJSAMPLE; this sets the required size
;;;679    	 * of the range_limit array.
;;;680    	 */
;;;681    	cur += GETJSAMPLE(*input_ptr);
00009a  781c              LDRB     r4,[r3,#0]
;;;682    	cur = GETJSAMPLE(range_limit[cur]);
00009c  9e01              LDR      r6,[sp,#4]
00009e  442c              ADD      r4,r4,r5              ;681
0000a0  5d36              LDRB     r6,[r6,r4]
;;;683    	/* Select output value, accumulate into output code for this pixel */
;;;684    	pixcode = GETJSAMPLE(colorindex_ci[cur]);
0000a2  9d05              LDR      r5,[sp,#0x14]
;;;685    	*output_ptr += (JSAMPLE) pixcode;
0000a4  7814              LDRB     r4,[r2,#0]
0000a6  5dad              LDRB     r5,[r5,r6]            ;684
0000a8  f1bc0c01          SUBS     r12,r12,#1            ;667
0000ac  442c              ADD      r4,r4,r5
0000ae  7014              STRB     r4,[r2,#0]
;;;686    	/* Compute actual representation error at this pixel */
;;;687    	/* Note: we can do this even though we don't have the final */
;;;688    	/* pixel code, because the colormap is orthogonal. */
;;;689    	cur -= GETJSAMPLE(colormap_ci[pixcode]);
0000b0  9c04              LDR      r4,[sp,#0x10]
;;;690    	/* Compute error fractions to be propagated to adjacent pixels.
;;;691    	 * Add these into the running sums, and simultaneously shift the
;;;692    	 * next-line error sums left by 1 column.
;;;693    	 */
;;;694    	bnexterr = cur;
;;;695    	delta = cur * 2;
;;;696    	cur += delta;		/* form error * 3 */
;;;697    	errorptr[0] = (FSERROR) (bpreverr + cur);
;;;698    	cur += delta;		/* form error * 5 */
;;;699    	bpreverr = belowerr + cur;
;;;700    	belowerr = bnexterr;
;;;701    	cur += delta;		/* form error * 7 */
;;;702    	/* At this point cur contains the 7/16 error value to be propagated
;;;703    	 * to the next pixel on the current line, and all the errors for the
;;;704    	 * next line have been shifted over. We are therefore ready to move on.
;;;705    	 */
;;;706    	input_ptr += dirnc;	/* advance input ptr to next column */
;;;707    	output_ptr += dir;	/* advance output ptr to next column */
0000b2  4442              ADD      r2,r2,r8
0000b4  5d65              LDRB     r5,[r4,r5]            ;689
0000b6  eba60e05          SUB      lr,r6,r5              ;689
0000ba  ea4f064e          LSL      r6,lr,#1              ;695
0000be  eb0e0506          ADD      r5,lr,r6              ;696
0000c2  eb0a0405          ADD      r4,r10,r5             ;697
0000c6  800c              STRH     r4,[r1,#0]            ;697
0000c8  9c06              LDR      r4,[sp,#0x18]         ;699
0000ca  4435              ADD      r5,r5,r6              ;698
0000cc  eb040a05          ADD      r10,r4,r5             ;699
0000d0  9c02              LDR      r4,[sp,#8]            ;706
0000d2  442e              ADD      r6,r6,r5              ;701
0000d4  f8cde018          STR      lr,[sp,#0x18]         ;706
0000d8  4423              ADD      r3,r3,r4              ;706
;;;708    	errorptr += dir;	/* advance errorptr to current column */
0000da  eb010148          ADD      r1,r1,r8,LSL #1
0000de  d1d7              BNE      |L12.144|
                  |L12.224|
;;;709          }
;;;710          /* Post-loop cleanup: we must unload the final error value into the
;;;711           * final fserrors[] entry.  Note we need not unload belowerr because
;;;712           * it is for the dummy column before or after the actual array.
;;;713           */
;;;714          errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */
0000e0  f8a1a000          STRH     r10,[r1,#0]
0000e4  1c40              ADDS     r0,r0,#1              ;644
                  |L12.230|
0000e6  9903              LDR      r1,[sp,#0xc]          ;644
0000e8  4288              CMP      r0,r1                 ;644
0000ea  dba0              BLT      |L12.46|
;;;715        }
;;;716        cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE);
0000ec  6d79              LDR      r1,[r7,#0x54]
0000ee  2001              MOVS     r0,#1
0000f0  b101              CBZ      r1,|L12.244|
0000f2  2000              MOVS     r0,#0
                  |L12.244|
0000f4  f1090901          ADD      r9,r9,#1              ;640
0000f8  6578              STR      r0,[r7,#0x54]         ;640
                  |L12.250|
0000fa  990a              LDR      r1,[sp,#0x28]         ;640
0000fc  4589              CMP      r9,r1                 ;640
0000fe  db8e              BLT      |L12.30|
;;;717      }
;;;718    }
000100  b00b              ADD      sp,sp,#0x2c
000102  e8bd8ff0          POP      {r4-r11,pc}
;;;719    
                          ENDP


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

                  quantize_ord_dither PROC
;;;518    METHODDEF(void)
;;;519    quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
000000  e92d4fff          PUSH     {r0-r11,lr}
;;;520    		     JSAMPARRAY output_buf, int num_rows)
;;;521    /* General case, with ordered dithering */
;;;522    {
;;;523      my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
;;;524      register JSAMPROW input_ptr;
;;;525      register JSAMPROW output_ptr;
;;;526      JSAMPROW colorindex_ci;
;;;527      int * dither;			/* points to active row of dither matrix */
;;;528      int row_index, col_index;	/* current indexes into dither matrix */
;;;529      int nc = cinfo->out_color_components;
;;;530      int ci;
;;;531      int row;
;;;532      JDIMENSION col;
;;;533      JDIMENSION width = cinfo->output_width;
000004  f8d0a078          LDR      r10,[r0,#0x78]
000008  f8d091cc          LDR      r9,[r0,#0x1cc]
00000c  b081              SUB      sp,sp,#4              ;522
00000e  6f00              LDR      r0,[r0,#0x70]
;;;534    
;;;535      for (row = 0; row < num_rows; row++) {
000010  f04f0800          MOV      r8,#0
000014  9000              STR      r0,[sp,#0]
000016  e038              B        |L13.138|
                  |L13.24|
;;;536        /* Initialize output values to 0 so can process components separately */
;;;537        jzero_far((void FAR *) output_buf[row],
000018  9803              LDR      r0,[sp,#0xc]
00001a  9900              LDR      r1,[sp,#0]
00001c  f8500028          LDR      r0,[r0,r8,LSL #2]
000020  f7fffffe          BL       jzero_far
;;;538    	      (size_t) (width * SIZEOF(JSAMPLE)));
;;;539        row_index = cquantize->row_index;
;;;540        for (ci = 0; ci < nc; ci++) {
000024  2000              MOVS     r0,#0
000026  f8d9b030          LDR      r11,[r9,#0x30]
00002a  e024              B        |L13.118|
                  |L13.44|
;;;541          input_ptr = input_buf[row] + ci;
00002c  9902              LDR      r1,[sp,#8]
;;;542          output_ptr = output_buf[row];
;;;543          colorindex_ci = cquantize->colorindex[ci];
;;;544          dither = cquantize->odither[ci][row_index];
00002e  f8d92018          LDR      r2,[r9,#0x18]
000032  f8511028          LDR      r1,[r1,r8,LSL #2]     ;541
000036  eb090480          ADD      r4,r9,r0,LSL #2
00003a  180b              ADDS     r3,r1,r0              ;541
00003c  9903              LDR      r1,[sp,#0xc]          ;542

⌨️ 快捷键说明

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