696 {
697
698 SkASSERT(dinfo->scale_num == dinfo->scale_denom);
699
700
701 static_assert(8 == DCTSIZE, "DCTSIZE (defined in jpeg library) should always be 8.");
702
703 if (JCS_YCbCr != dinfo->jpeg_color_space) {
704 return false;
705 }
706
707 SkASSERT(3 == dinfo->num_components);
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725 if ((1 != dinfo->comp_info[1].h_samp_factor) ||
726 (1 != dinfo->comp_info[1].v_samp_factor) ||
727 (1 != dinfo->comp_info[2].h_samp_factor) ||
728 (1 != dinfo->comp_info[2].v_samp_factor))
729 {
730 return false;
731 }
732
733
734
735
736
737
738
739
740
741 int hSampY = dinfo->comp_info[0].h_samp_factor;
742 int vSampY = dinfo->comp_info[0].v_samp_factor;
743 SkASSERT(hSampY == dinfo->max_h_samp_factor);
744 SkASSERT(vSampY == dinfo->max_v_samp_factor);
745
747 if (1 == hSampY && 1 == vSampY) {
749 } else if (2 == hSampY && 1 == vSampY) {
751 } else if (2 == hSampY && 2 == vSampY) {
753 } else if (1 == hSampY && 2 == vSampY) {
755 } else if (4 == hSampY && 1 == vSampY) {
757 } else if (4 == hSampY && 2 == vSampY) {
759 } else {
760 return false;
761 }
762 if (supportedDataTypes &&
765 return false;
766 }
767 if (yuvaPixmapInfo) {
770 for (
int i = 0;
i < 3; ++
i) {
772 rowBytes[
i] = dinfo->comp_info[
i].width_in_blocks * DCTSIZE;
773 }
776 tempSubsampling,
782 }
783 return true;
784}
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kJPEG_Full_SkYUVColorSpace
describes full range
SkISize dimensions() const
SkEncodedOrigin getOrigin() const
@ kY_U_V
Plane 0: Y, Plane 1: U, Plane 2: V.
@ k440
1 set of UV values for each 1x2 block of Y values.
@ k420
1 set of UV values for each 2x2 block of Y values.
@ k410
1 set of UV values for each 4x2 block of Y values.
@ k411
1 set of UV values for each 4x1 block of Y values.
@ k422
1 set of UV values for each 2x1 block of Y values.
@ k444
No subsampling. UV values for each Y.
constexpr bool supported(PlaneConfig, DataType) const
@ kUnorm8
8 bit unsigned normalized
static constexpr auto kMaxPlanes