Lines Matching refs:img
66 static status_t _ImageCopy(View &view, const MediaImage2 *img, ImagePixel *imgBase) { in _ImageCopy() argument
69 const size_t bpp = divUp(img->mBitDepthAllocated, 8u); in _ImageCopy()
73 imgBase + img->mPlane[i].mOffset; in _ImageCopy()
77 if (plane.colSampling != img->mPlane[i].mHorizSubsampling in _ImageCopy()
78 || plane.rowSampling != img->mPlane[i].mVertSubsampling in _ImageCopy()
79 || plane.allocatedDepth != img->mBitDepthAllocated in _ImageCopy()
87 uint32_t planeW = img->mWidth / plane.colSampling; in _ImageCopy()
88 uint32_t planeH = img->mHeight / plane.rowSampling; in _ImageCopy()
90 bool canCopyByRow = (plane.colInc == 1) && (img->mPlane[i].mColInc == 1); in _ImageCopy()
91 bool canCopyByPlane = canCopyByRow && (plane.rowInc == img->mPlane[i].mRowInc); in _ImageCopy()
97 imgRow, viewRow, std::min(plane.rowInc, img->mPlane[i].mRowInc)); in _ImageCopy()
98 imgRow += img->mPlane[i].mRowInc; in _ImageCopy()
107 imgPtr += img->mPlane[i].mColInc; in _ImageCopy()
110 imgRow += img->mPlane[i].mRowInc; in _ImageCopy()
120 status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view) { in ImageCopy() argument
121 if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) { in ImageCopy()
124 if ((IsNV12(view) && IsI420(img)) || (IsI420(view) && IsNV12(img))) { in ImageCopy()
132 uint8_t* dst_y = imgBase + img->mPlane[0].mOffset; in ImageCopy()
133 uint8_t* dst_u = imgBase + img->mPlane[1].mOffset; in ImageCopy()
134 uint8_t* dst_v = imgBase + img->mPlane[2].mOffset; in ImageCopy()
135 int32_t dst_stride_y = img->mPlane[0].mRowInc; in ImageCopy()
136 int32_t dst_stride_u = img->mPlane[1].mRowInc; in ImageCopy()
137 int32_t dst_stride_v = img->mPlane[2].mRowInc; in ImageCopy()
138 if (IsNV12(view) && IsI420(img)) { in ImageCopy()
152 return _ImageCopy<true>(view, img, imgBase); in ImageCopy()
155 status_t ImageCopy(C2GraphicView &view, const uint8_t *imgBase, const MediaImage2 *img) { in ImageCopy() argument
156 if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) { in ImageCopy()
159 if ((IsNV12(img) && IsI420(view)) || (IsI420(img) && IsNV12(view))) { in ImageCopy()
161 const uint8_t* src_y = imgBase + img->mPlane[0].mOffset; in ImageCopy()
162 const uint8_t* src_u = imgBase + img->mPlane[1].mOffset; in ImageCopy()
163 const uint8_t* src_v = imgBase + img->mPlane[2].mOffset; in ImageCopy()
164 int32_t src_stride_y = img->mPlane[0].mRowInc; in ImageCopy()
165 int32_t src_stride_u = img->mPlane[1].mRowInc; in ImageCopy()
166 int32_t src_stride_v = img->mPlane[2].mRowInc; in ImageCopy()
173 if (IsNV12(img) && IsI420(view)) { in ImageCopy()
187 return _ImageCopy<false>(view, img, imgBase); in ImageCopy()
242 bool IsYUV420(const MediaImage2 *img) { in IsYUV420() argument
243 return (img->mType == MediaImage2::MEDIA_IMAGE_TYPE_YUV in IsYUV420()
244 && img->mNumPlanes == 3 in IsYUV420()
245 && img->mBitDepth == 8 in IsYUV420()
246 && img->mBitDepthAllocated == 8 in IsYUV420()
247 && img->mPlane[0].mHorizSubsampling == 1 in IsYUV420()
248 && img->mPlane[0].mVertSubsampling == 1 in IsYUV420()
249 && img->mPlane[1].mHorizSubsampling == 2 in IsYUV420()
250 && img->mPlane[1].mVertSubsampling == 2 in IsYUV420()
251 && img->mPlane[2].mHorizSubsampling == 2 in IsYUV420()
252 && img->mPlane[2].mVertSubsampling == 2); in IsYUV420()
255 bool IsNV12(const MediaImage2 *img) { in IsNV12() argument
256 if (!IsYUV420(img)) { in IsNV12()
259 return (img->mPlane[1].mColInc == 2 in IsNV12()
260 && img->mPlane[2].mColInc == 2 in IsNV12()
261 && (img->mPlane[2].mOffset - img->mPlane[1].mOffset == 1)); in IsNV12()
264 bool IsI420(const MediaImage2 *img) { in IsI420() argument
265 if (!IsYUV420(img)) { in IsI420()
268 return (img->mPlane[1].mColInc == 1 in IsI420()
269 && img->mPlane[2].mColInc == 1 in IsI420()
270 && img->mPlane[2].mOffset > img->mPlane[1].mOffset); in IsI420()