📄 jquant2.txt
字号:
;;;1252 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
;;;1253 SIZEOF(my_cquantizer));
;;;1254 cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
;;;1255 cquantize->pub.start_pass = start_pass_2_quant;
000012 4936 LDR r1,|L8.236|
000014 f8c401cc STR r0,[r4,#0x1cc]
;;;1256 cquantize->pub.new_color_map = new_color_map_2_quant;
000018 6001 STR r1,[r0,#0]
;;;1257 cquantize->fserrors = NULL; /* flag optional arrays not allocated */
00001a 2700 MOVS r7,#0
;;;1258 cquantize->error_limiter = NULL;
00001c 6207 STR r7,[r0,#0x20]
00001e 4934 LDR r1,|L8.240|
;;;1259
;;;1260 /* Make sure jdmaster didn't give me a case I can't handle */
;;;1261 if (cinfo->out_color_components != 3)
000020 6287 STR r7,[r0,#0x28]
000022 4605 MOV r5,r0 ;1251
000024 60c1 STR r1,[r0,#0xc]
000026 6fa0 LDR r0,[r4,#0x78]
000028 2803 CMP r0,#3
00002a d006 BEQ |L8.58|
;;;1262 ERREXIT(cinfo, JERR_NOTIMPL);
00002c 6821 LDR r1,[r4,#0]
00002e 202f MOVS r0,#0x2f
000030 6148 STR r0,[r1,#0x14]
000032 6820 LDR r0,[r4,#0]
000034 6801 LDR r1,[r0,#0]
000036 4620 MOV r0,r4
000038 4788 BLX r1
|L8.58|
;;;1263
;;;1264 /* Allocate the histogram/inverse colormap storage */
;;;1265 cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small)
00003a 6860 LDR r0,[r4,#4]
00003c 2280 MOVS r2,#0x80
00003e 6803 LDR r3,[r0,#0]
000040 2101 MOVS r1,#1
000042 4620 MOV r0,r4
000044 4798 BLX r3
;;;1266 ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d));
;;;1267 for (i = 0; i < HIST_C0_ELEMS; i++) {
000046 2600 MOVS r6,#0
;;;1268 cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large)
000048 f44f5880 MOV r8,#0x1000
00004c 61a8 STR r0,[r5,#0x18]
|L8.78|
00004e 6860 LDR r0,[r4,#4]
000050 4642 MOV r2,r8
000052 6843 LDR r3,[r0,#4]
000054 2101 MOVS r1,#1
000056 4620 MOV r0,r4
000058 4798 BLX r3
00005a 69a9 LDR r1,[r5,#0x18]
00005c f8410026 STR r0,[r1,r6,LSL #2]
000060 1c76 ADDS r6,r6,#1 ;1267
000062 2e20 CMP r6,#0x20 ;1267
000064 dbf3 BLT |L8.78|
;;;1269 ((j_common_ptr) cinfo, JPOOL_IMAGE,
;;;1270 HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
;;;1271 }
;;;1272 cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
000066 2001 MOVS r0,#1
;;;1273
;;;1274 /* Allocate storage for the completed colormap, if required.
;;;1275 * We do this now since it is FAR storage and may affect
;;;1276 * the memory manager's space calculations.
;;;1277 */
;;;1278 if (cinfo->enable_2pass_quant) {
000068 61e8 STR r0,[r5,#0x1c]
00006a 6ee0 LDR r0,[r4,#0x6c]
00006c b318 CBZ r0,|L8.182|
;;;1279 /* Make sure color count is acceptable */
;;;1280 int desired = cinfo->desired_number_of_colors;
;;;1281 /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
;;;1282 if (desired < 8)
00006e 6e26 LDR r6,[r4,#0x60]
000070 2e08 CMP r6,#8
000072 da09 BGE |L8.136|
;;;1283 ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
000074 6821 LDR r1,[r4,#0]
000076 2038 MOVS r0,#0x38
000078 6148 STR r0,[r1,#0x14]
00007a 6821 LDR r1,[r4,#0]
00007c 2008 MOVS r0,#8
00007e 6188 STR r0,[r1,#0x18]
000080 6820 LDR r0,[r4,#0]
000082 6801 LDR r1,[r0,#0]
000084 4620 MOV r0,r4
000086 4788 BLX r1
|L8.136|
;;;1284 /* Make sure colormap indexes can be represented by JSAMPLEs */
;;;1285 if (desired > MAXNUMCOLORS)
000088 f44f7080 MOV r0,#0x100
00008c 4286 CMP r6,r0
00008e dd08 BLE |L8.162|
;;;1286 ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
000090 6822 LDR r2,[r4,#0]
000092 2139 MOVS r1,#0x39
000094 6151 STR r1,[r2,#0x14]
000096 6821 LDR r1,[r4,#0]
000098 6188 STR r0,[r1,#0x18]
00009a 6820 LDR r0,[r4,#0]
00009c 6801 LDR r1,[r0,#0]
00009e 4620 MOV r0,r4
0000a0 4788 BLX r1
|L8.162|
;;;1287 cquantize->sv_colormap = (*cinfo->mem->alloc_sarray)
0000a2 6860 LDR r0,[r4,#4]
0000a4 2303 MOVS r3,#3
0000a6 6887 LDR r7,[r0,#8]
0000a8 4632 MOV r2,r6
0000aa 2101 MOVS r1,#1
0000ac 4620 MOV r0,r4
0000ae 47b8 BLX r7
;;;1288 ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
;;;1289 cquantize->desired = desired;
;;;1290 } else
0000b0 e9c50604 STRD r0,r6,[r5,#0x10]
0000b4 e000 B |L8.184|
|L8.182|
;;;1291 cquantize->sv_colormap = NULL;
0000b6 612f STR r7,[r5,#0x10]
|L8.184|
;;;1292
;;;1293 /* Only F-S dithering or no dithering is supported. */
;;;1294 /* If user asks for ordered dither, give him F-S. */
;;;1295 if (cinfo->dither_mode != JDITHER_NONE)
0000b8 f8940058 LDRB r0,[r4,#0x58]
0000bc 2800 CMP r0,#0
0000be d012 BEQ |L8.230|
;;;1296 cinfo->dither_mode = JDITHER_FS;
0000c0 2002 MOVS r0,#2
0000c2 f8840058 STRB r0,[r4,#0x58]
;;;1297
;;;1298 /* Allocate Floyd-Steinberg workspace if necessary.
;;;1299 * This isn't really needed until pass 2, but again it is FAR storage.
;;;1300 * Although we will cope with a later change in dither_mode,
;;;1301 * we do not promise to honor max_memory_to_use if dither_mode changes.
;;;1302 */
;;;1303 if (cinfo->dither_mode == JDITHER_FS) {
;;;1304 cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
0000c6 6f20 LDR r0,[r4,#0x70]
0000c8 1c80 ADDS r0,r0,#2
0000ca eb000040 ADD r0,r0,r0,LSL #1
0000ce 0042 LSLS r2,r0,#1
0000d0 6860 LDR r0,[r4,#4]
0000d2 2101 MOVS r1,#1
0000d4 6843 LDR r3,[r0,#4]
0000d6 4620 MOV r0,r4
0000d8 4798 BLX r3
;;;1305 ((j_common_ptr) cinfo, JPOOL_IMAGE,
;;;1306 (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR))));
;;;1307 /* Might as well create the error-limiting table too. */
;;;1308 init_error_limit(cinfo);
0000da 6228 STR r0,[r5,#0x20]
0000dc 4620 MOV r0,r4
0000de e8bd41f0 POP {r4-r8,lr}
0000e2 f7ffbffe B.W init_error_limit
|L8.230|
;;;1309 }
;;;1310 }
0000e6 e8bd81f0 POP {r4-r8,pc}
;;;1311
ENDP
0000ea 0000 DCW 0x0000
|L8.236|
DCD start_pass_2_quant
|L8.240|
DCD new_color_map_2_quant
AREA ||i.median_cut||, CODE, READONLY, ALIGN=2
median_cut PROC
;;;424 LOCAL(int)
;;;425 median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
000000 e92d5fff PUSH {r0-r12,lr}
;;;426 int desired_colors)
;;;427 /* Repeatedly select and split the largest box until we have enough boxes */
;;;428 {
000004 4688 MOV r8,r1
000006 4615 MOV r5,r2
;;;429 int n,lb;
;;;430 int c0,c1,c2,cmax;
;;;431 register boxptr b1,b2;
;;;432
;;;433 while (numboxes < desired_colors) {
;;;434 /* Select box to split.
;;;435 * Current algorithm: by population for first half, then by volume.
;;;436 */
;;;437 if (numboxes*2 <= desired_colors) {
;;;438 b1 = find_biggest_color_pop(boxlist, numboxes);
;;;439 } else {
;;;440 b1 = find_biggest_volume(boxlist, numboxes);
;;;441 }
;;;442 if (b1 == NULL) /* no splittable boxes left! */
;;;443 break;
;;;444 b2 = &boxlist[numboxes]; /* where new box will go */
;;;445 /* Copy the color bounds to the new box. */
;;;446 b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
;;;447 b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
;;;448 /* Choose which axis to split the box on.
;;;449 * Current algorithm: longest scaled axis.
;;;450 * See notes in update_box about scaling distances.
;;;451 */
;;;452 c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
;;;453 c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
;;;454 c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
;;;455 /* We want to break any ties in favor of green, then red, blue last.
;;;456 * This code does the right thing for R,G,B or B,G,R color orders only.
;;;457 */
;;;458 #if RGB_RED == 0
;;;459 cmax = c1; n = 1;
;;;460 if (c0 > cmax) { cmax = c0; n = 0; }
;;;461 if (c2 > cmax) { n = 2; }
;;;462 #else
;;;463 cmax = c1; n = 1;
;;;464 if (c2 > cmax) { cmax = c2; n = 2; }
;;;465 if (c0 > cmax) { n = 0; }
;;;466 #endif
;;;467 /* Choose split point along selected axis, and update box bounds.
;;;468 * Current algorithm: split at halfway point.
;;;469 * (Since the box has been shrunk to minimum volume,
;;;470 * any split will produce two nonempty subboxes.)
;;;471 * Note that lb value is max for lower box, so must be < old max.
;;;472 */
;;;473 switch (n) {
;;;474 case 0:
;;;475 lb = (b1->c0max + b1->c0min) / 2;
;;;476 b1->c0max = lb;
;;;477 b2->c0min = lb+1;
;;;478 break;
;;;479 case 1:
;;;480 lb = (b1->c1max + b1->c1min) / 2;
;;;481 b1->c1max = lb;
;;;482 b2->c1min = lb+1;
;;;483 break;
;;;484 case 2:
;;;485 lb = (b1->c2max + b1->c2min) / 2;
;;;486 b1->c2max = lb;
;;;487 b2->c2min = lb+1;
;;;488 break;
;;;489 }
;;;490 /* Update stats for boxes */
;;;491 update_box(cinfo, b1);
;;;492 update_box(cinfo, b2);
;;;493 numboxes++;
000008 e05f B |L9.202|
00000a bf00 NOP ;437
|L9.12|
00000c f04f0400 MOV r4,#0 ;437
000010 ebb00f45 CMP r0,r5,LSL #1 ;437
000014 4621 MOV r1,r4 ;437
000016 4622 MOV r2,r4 ;437
000018 4640 MOV r0,r8 ;437
00001a db0d BLT |L9.56|
00001c e009 B |L9.50|
|L9.30|
00001e 69c3 LDR r3,[r0,#0x1c] ;437
000020 42a3 CMP r3,r4 ;437
000022 dd04 BLE |L9.46|
000024 6986 LDR r6,[r0,#0x18] ;437
000026 2e00 CMP r6,#0 ;437
000028 dd01 BLE |L9.46|
00002a 4601 MOV r1,r0 ;437
00002c 461c MOV r4,r3 ;437
|L9.46|
00002e 1c52 ADDS r2,r2,#1 ;437
000030 3020 ADDS r0,r0,#0x20 ;437
|L9.50|
000032 42aa CMP r2,r5 ;437
000034 dbf3 BLT |L9.30|
000036 e009 B |L9.76|
|L9.56|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -