441 {
442 FilterProc* proc_1_2 = nullptr;
443 FilterProc* proc_1_3 = nullptr;
444 FilterProc* proc_2_1 = nullptr;
445 FilterProc* proc_2_2 = nullptr;
446 FilterProc* proc_2_3 = nullptr;
447 FilterProc* proc_3_1 = nullptr;
448 FilterProc* proc_3_2 = nullptr;
449 FilterProc* proc_3_3 = nullptr;
450
451 switch (
root.colorType()) {
454 proc_1_2 = downsample_1_2<ColorTypeFilter_8888>;
455 proc_1_3 = downsample_1_3<ColorTypeFilter_8888>;
456 proc_2_1 = downsample_2_1<ColorTypeFilter_8888>;
457 proc_2_2 = downsample_2_2<ColorTypeFilter_8888>;
458 proc_2_3 = downsample_2_3<ColorTypeFilter_8888>;
459 proc_3_1 = downsample_3_1<ColorTypeFilter_8888>;
460 proc_3_2 = downsample_3_2<ColorTypeFilter_8888>;
461 proc_3_3 = downsample_3_3<ColorTypeFilter_8888>;
462 break;
464 proc_1_2 = downsample_1_2<ColorTypeFilter_565>;
465 proc_1_3 = downsample_1_3<ColorTypeFilter_565>;
466 proc_2_1 = downsample_2_1<ColorTypeFilter_565>;
467 proc_2_2 = downsample_2_2<ColorTypeFilter_565>;
468 proc_2_3 = downsample_2_3<ColorTypeFilter_565>;
469 proc_3_1 = downsample_3_1<ColorTypeFilter_565>;
470 proc_3_2 = downsample_3_2<ColorTypeFilter_565>;
471 proc_3_3 = downsample_3_3<ColorTypeFilter_565>;
472 break;
474 proc_1_2 = downsample_1_2<ColorTypeFilter_4444>;
475 proc_1_3 = downsample_1_3<ColorTypeFilter_4444>;
476 proc_2_1 = downsample_2_1<ColorTypeFilter_4444>;
477 proc_2_2 = downsample_2_2<ColorTypeFilter_4444>;
478 proc_2_3 = downsample_2_3<ColorTypeFilter_4444>;
479 proc_3_1 = downsample_3_1<ColorTypeFilter_4444>;
480 proc_3_2 = downsample_3_2<ColorTypeFilter_4444>;
481 proc_3_3 = downsample_3_3<ColorTypeFilter_4444>;
482 break;
486 proc_1_2 = downsample_1_2<ColorTypeFilter_8>;
487 proc_1_3 = downsample_1_3<ColorTypeFilter_8>;
488 proc_2_1 = downsample_2_1<ColorTypeFilter_8>;
489 proc_2_2 = downsample_2_2<ColorTypeFilter_8>;
490 proc_2_3 = downsample_2_3<ColorTypeFilter_8>;
491 proc_3_1 = downsample_3_1<ColorTypeFilter_8>;
492 proc_3_2 = downsample_3_2<ColorTypeFilter_8>;
493 proc_3_3 = downsample_3_3<ColorTypeFilter_8>;
494 break;
497 proc_1_2 = downsample_1_2<ColorTypeFilter_RGBA_F16>;
498 proc_1_3 = downsample_1_3<ColorTypeFilter_RGBA_F16>;
499 proc_2_1 = downsample_2_1<ColorTypeFilter_RGBA_F16>;
500 proc_2_2 = downsample_2_2<ColorTypeFilter_RGBA_F16>;
501 proc_2_3 = downsample_2_3<ColorTypeFilter_RGBA_F16>;
502 proc_3_1 = downsample_3_1<ColorTypeFilter_RGBA_F16>;
503 proc_3_2 = downsample_3_2<ColorTypeFilter_RGBA_F16>;
504 proc_3_3 = downsample_3_3<ColorTypeFilter_RGBA_F16>;
505 break;
507 proc_1_2 = downsample_1_2<ColorTypeFilter_88>;
508 proc_1_3 = downsample_1_3<ColorTypeFilter_88>;
509 proc_2_1 = downsample_2_1<ColorTypeFilter_88>;
510 proc_2_2 = downsample_2_2<ColorTypeFilter_88>;
511 proc_2_3 = downsample_2_3<ColorTypeFilter_88>;
512 proc_3_1 = downsample_3_1<ColorTypeFilter_88>;
513 proc_3_2 = downsample_3_2<ColorTypeFilter_88>;
514 proc_3_3 = downsample_3_3<ColorTypeFilter_88>;
515 break;
517 proc_1_2 = downsample_1_2<ColorTypeFilter_1616>;
518 proc_1_3 = downsample_1_3<ColorTypeFilter_1616>;
519 proc_2_1 = downsample_2_1<ColorTypeFilter_1616>;
520 proc_2_2 = downsample_2_2<ColorTypeFilter_1616>;
521 proc_2_3 = downsample_2_3<ColorTypeFilter_1616>;
522 proc_3_1 = downsample_3_1<ColorTypeFilter_1616>;
523 proc_3_2 = downsample_3_2<ColorTypeFilter_1616>;
524 proc_3_3 = downsample_3_3<ColorTypeFilter_1616>;
525 break;
527 proc_1_2 = downsample_1_2<ColorTypeFilter_16>;
528 proc_1_3 = downsample_1_3<ColorTypeFilter_16>;
529 proc_2_1 = downsample_2_1<ColorTypeFilter_16>;
530 proc_2_2 = downsample_2_2<ColorTypeFilter_16>;
531 proc_2_3 = downsample_2_3<ColorTypeFilter_16>;
532 proc_3_1 = downsample_3_1<ColorTypeFilter_16>;
533 proc_3_2 = downsample_3_2<ColorTypeFilter_16>;
534 proc_3_3 = downsample_3_3<ColorTypeFilter_16>;
535 break;
538 proc_1_2 = downsample_1_2<ColorTypeFilter_1010102>;
539 proc_1_3 = downsample_1_3<ColorTypeFilter_1010102>;
540 proc_2_1 = downsample_2_1<ColorTypeFilter_1010102>;
541 proc_2_2 = downsample_2_2<ColorTypeFilter_1010102>;
542 proc_2_3 = downsample_2_3<ColorTypeFilter_1010102>;
543 proc_3_1 = downsample_3_1<ColorTypeFilter_1010102>;
544 proc_3_2 = downsample_3_2<ColorTypeFilter_1010102>;
545 proc_3_3 = downsample_3_3<ColorTypeFilter_1010102>;
546 break;
548 proc_1_2 = downsample_1_2<ColorTypeFilter_Alpha_F16>;
549 proc_1_3 = downsample_1_3<ColorTypeFilter_Alpha_F16>;
550 proc_2_1 = downsample_2_1<ColorTypeFilter_Alpha_F16>;
551 proc_2_2 = downsample_2_2<ColorTypeFilter_Alpha_F16>;
552 proc_2_3 = downsample_2_3<ColorTypeFilter_Alpha_F16>;
553 proc_3_1 = downsample_3_1<ColorTypeFilter_Alpha_F16>;
554 proc_3_2 = downsample_3_2<ColorTypeFilter_Alpha_F16>;
555 proc_3_3 = downsample_3_3<ColorTypeFilter_Alpha_F16>;
556 break;
558 proc_1_2 = downsample_1_2<ColorTypeFilter_F16F16>;
559 proc_1_3 = downsample_1_3<ColorTypeFilter_F16F16>;
560 proc_2_1 = downsample_2_1<ColorTypeFilter_F16F16>;
561 proc_2_2 = downsample_2_2<ColorTypeFilter_F16F16>;
562 proc_2_3 = downsample_2_3<ColorTypeFilter_F16F16>;
563 proc_3_1 = downsample_3_1<ColorTypeFilter_F16F16>;
564 proc_3_2 = downsample_3_2<ColorTypeFilter_F16F16>;
565 proc_3_3 = downsample_3_3<ColorTypeFilter_F16F16>;
566 break;
568 proc_1_2 = downsample_1_2<ColorTypeFilter_16161616>;
569 proc_1_3 = downsample_1_3<ColorTypeFilter_16161616>;
570 proc_2_1 = downsample_2_1<ColorTypeFilter_16161616>;
571 proc_2_2 = downsample_2_2<ColorTypeFilter_16161616>;
572 proc_2_3 = downsample_2_3<ColorTypeFilter_16161616>;
573 proc_3_1 = downsample_3_1<ColorTypeFilter_16161616>;
574 proc_3_2 = downsample_3_2<ColorTypeFilter_16161616>;
575 proc_3_3 = downsample_3_3<ColorTypeFilter_16161616>;
576 break;
577
586 return nullptr;
587
589 return nullptr;
590 }
591
592 auto sampler = std::make_unique<HQDownSampler>();
593 sampler->proc_1_2 = proc_1_2;
594 sampler->proc_1_3 = proc_1_3;
595 sampler->proc_2_1 = proc_2_1;
596 sampler->proc_2_2 = proc_2_2;
597 sampler->proc_2_3 = proc_2_3;
598 sampler->proc_3_1 = proc_3_1;
599 sampler->proc_3_2 = proc_3_2;
600 sampler->proc_3_3 = proc_3_3;
601 return sampler;
602}
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
@ kRGBA_10x6_SkColorType
pixel with 10 used bits (most significant) followed by 6 unused
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
@ kSRGBA_8888_SkColorType
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kBGRA_10101010_XR_SkColorType
pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
@ kUnknown_SkColorType
uninitialized
@ kR16G16_float_SkColorType
pixel with a half float for red and green