Searched refs:dstSize (Results 1 - 18 of 18) sorted by relevance

/external/skia/tests/
H A DPackBitsTest.cpp36 size_t dstSize = SkPackBits::Pack16(gTests[i].fSrc, local
39 int srcCount = SkPackBits::Unpack16(dst, dstSize, src);
51 size_t dstSize = SkPackBits::Pack16(src, size, dst); local
53 REPORTER_ASSERT(reporter, maxSize >= dstSize);
55 int srcCount = SkPackBits::Unpack16(dst, dstSize, src2);
88 size_t dstSize = SkPackBits::Pack8(gTests[i].fSrc, local
90 REPORTER_ASSERT(reporter, dstSize <= maxSize);
92 int srcCount = SkPackBits::Unpack8(dst, dstSize, src);
105 size_t dstSize = SkPackBits::Pack8(src, size, dst); local
107 REPORTER_ASSERT(reporter, maxSize >= dstSize);
[all...]
/external/icu/icu4c/source/common/
H A Dunistr_cnv.cpp122 uint32_t dstSize) const {
123 return extract(start, length, target, dstSize, 0);
133 uint32_t dstSize,
137 if(/*dstSize < 0 || */(dstSize > 0 && target == 0)) {
144 // We need to cast dstSize to int32_t for all subsequent code.
146 // Also, dstSize==0xffffffff means "unlimited" but if we use target+dstSize
150 if(dstSize < 0x7fffffff) {
152 capacity = (int32_t)dstSize;
130 extract(int32_t start, int32_t length, char *target, uint32_t dstSize, const char *codepage) const argument
[all...]
H A Dunistr.cpp829 char *target, uint32_t dstSize) const {
831 if(/*dstSize < 0 || */(dstSize > 0 && target == 0)) {
834 return toUTF8(start, len, target, dstSize <= 0x7fffffff ? (int32_t)dstSize : 0x7fffffff);
/external/libvncserver/test/
H A Dtjunittest.c239 unsigned long *dstSize, int w, int h, int pf, char *basename,
252 if(*dstBuf && *dstSize>0) memset(*dstBuf, 0, *dstSize);
255 *dstSize=tjBufSize(w, h, subsamp);
256 _tj(tjCompress2(handle, srcBuf, w, 0, h, pf, dstBuf, dstSize, subsamp,
263 writeJPEG(*dstBuf, *dstSize, tempStr);
280 unsigned long dstSize=0; local
293 dstSize=scaledWidth*scaledHeight*tjPixelSize[pf];
294 if((dstBuf=(unsigned char *)malloc(dstSize))==NULL)
296 memset(dstBuf, 0, dstSize);
238 compTest(tjhandle handle, unsigned char **dstBuf, unsigned long *dstSize, int w, int h, int pf, char *basename, int subsamp, int jpegQual, int flags) argument
[all...]
/external/lz4/lib/
H A Dlz4frame.c453 typedef int (*compressFunc_t)(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level);
472 static int LZ4F_localLZ4_compress_limitedOutput_withState(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) argument
475 return LZ4_compress_limitedOutput_withState(ctx, src, dst, srcSize, dstSize);
478 static int LZ4F_localLZ4_compress_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) argument
481 return LZ4_compress_limitedOutput_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstSize);
484 static int LZ4F_localLZ4_compressHC_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) argument
487 return LZ4_compressHC_limitedOutput_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstSize);
856 static void LZ4F_updateDict(LZ4F_dctx_internal_t* dctxPtr, const BYTE* dstPtr, size_t dstSize, const BYTE* dstPtr0, unsigned withinTmp) argument
863 dctxPtr->dictSize += dstSize;
867 if (dstPtr - dstPtr0 + dstSize >
[all...]
/external/deqp/modules/gles3/functional/
H A Des3fBufferCopyTests.cpp57 int dstSize,
68 , m_dstSize (dstSize)
286 int dstSize; member in struct:deqp::gles3::Functional::__anon3287
292 // srcSize dstSize srcOffs dstOffs copySize
311 dstTarget, cases[ndx].dstSize, hint,
50 BasicBufferCopyCase(Context& context, const char* name, const char* desc, deUint32 srcTarget, int srcSize, deUint32 srcHint, deUint32 dstTarget, int dstSize, deUint32 dstHint, int copySrcOffset, int copyDstOffset, int copySize, VerifyType verifyType) argument
H A Des3fVertexTextureTests.cpp499 float calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const;
640 float Vertex2DTextureCase::calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const argument
644 const Vec2 sizeRatio = texScale*srcSize / dstSize;
805 float calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const;
961 float VertexCubeTextureCase::calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const argument
965 const Vec2 sizeRatio = texScale*srcSize / dstSize;
1143 float calculateLod (const Mat3& transf, const Vec2& dstSize, int textureNdx) const;
1286 float Vertex2DArrayTextureCase::calculateLod (const Mat3& transf, const Vec2& dstSize, int textureNdx) const argument
1298 const float dudx = (trans10.x() - trans00.x()) * (float)texWidth / dstSize.x();
1299 const float dudy = (trans01.x() - trans00.x()) * (float)texWidth / dstSize
1626 calculateLod(const Mat3& transf, const Vec2& dstSize, int textureNdx) const argument
[all...]
H A Des3fFramebufferBlitTests.cpp58 BlitRectCase (Context& context, const char* name, const char* desc, deUint32 filter, const IVec2& srcSize, const IVec4& srcRect, const IVec2& dstSize, const IVec4& dstRect, int cellSize = 8) argument
63 , m_dstSize (dstSize)
167 BlitNearestFilterConsistencyCase (Context& context, const char* name, const char* desc, const IVec2& srcSize, const IVec4& srcRect, const IVec2& dstSize, const IVec4& dstRect);
172 BlitNearestFilterConsistencyCase::BlitNearestFilterConsistencyCase (Context& context, const char* name, const char* desc, const IVec2& srcSize, const IVec4& srcRect, const IVec2& dstSize, const IVec4& dstRect) argument
173 : BlitRectCase(context, name, desc, GL_NEAREST, srcSize, srcRect, dstSize, dstRect, 1)
459 BlitDepthStencilCase (Context& context, const char* name, const char* desc, deUint32 format, deUint32 srcBuffers, const IVec2& srcSize, const IVec4& srcRect, deUint32 dstBuffers, const IVec2& dstSize, const IVec4& dstRect, deUint32 copyBuffers) argument
466 , m_dstSize (dstSize)
975 const IVec2 dstSize(132, 128);
990 rectGroup->addChild(new BlitRectCase(m_context, (name + "_nearest").c_str(), "", GL_NEAREST, srcSize, srcRect, dstSize, dstRect));
991 rectGroup->addChild(new BlitRectCase(m_context, (name + "_linear").c_str(), "", GL_LINEAR, srcSize, srcRect, dstSize, dstRec
[all...]
/external/skia/src/effects/
H A DSkBlurMask.cpp536 size_t dstSize = dst->computeImageSize(); local
537 if (0 == dstSize) {
544 uint8_t* dp = SkMask::AllocImage(dstSize);
548 SkAutoTMalloc<uint8_t> tmpBuffer(dstSize);
777 size_t dstSize = dst->computeImageSize(); local
778 if (0 == dstSize) {
782 uint8_t* dp = SkMask::AllocImage(dstSize);
897 size_t dstSize = dst->computeImageSize(); local
898 if (0 == dstSize) {
907 uint8_t* dstPixels = SkMask::AllocImage(dstSize);
[all...]
/external/deqp/modules/glshared/
H A DglsTextureTestUtil.cpp235 static float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, deInt32 srcSize, const tcu::Vec3& sq) argument
239 float dx = (float)dstSize.x();
240 float dy = (float)dstSize.y();
273 static float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, const tcu::IVec2& srcSize, const tcu::Vec3& sq, const tcu::Vec3& tq) argument
279 float dx = (float)dstSize.x();
280 float dy = (float)dstSize.y();
314 static float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, const tcu::IVec3& srcSize, const tcu::Vec3& sq, const tcu::Vec3& tq, const tcu::Vec3& rq) argument
322 float dx = (float)dstSize.x();
323 float dy = (float)dstSize.y();
437 tcu::IVec2 dstSize local
472 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight()); local
653 const tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight()); local
714 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight()); local
763 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight()); local
809 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight()); local
1714 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
1818 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2002 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2182 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2352 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2460 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2648 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2828 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
2941 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
3063 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight()); local
[all...]
/external/skia/src/gpu/
H A DSkGpuDevice.cpp1152 SkSize dstSize;
1158 dstSize.fWidth = w;
1159 dstSize.fHeight = h;
1164 dstSize = *dstSizePtr;
1191 SkRect dstRect = SkRect::MakeXYWH(0, 0, dstSize.fWidth, dstSize.fHeight);
1215 localM.postScale(dstSize.fWidth / srcRectPtr->width(),
1216 dstSize.fHeight / srcRectPtr->height());
1244 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize
1628 SkSize dstSize; local
[all...]
/external/lz4/programs/
H A Dfullbench.c392 size_t dstSize = outSize; local
394 result = LZ4F_decompress(g_dCtx, out, &dstSize, in, &srcSize, NULL);
397 return (int)dstSize;
/external/deqp/modules/gles2/functional/
H A Des2fVertexTextureTests.cpp401 float calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const;
539 float Vertex2DTextureCase::calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const argument
543 const Vec2 sizeRatio = texScale*srcSize / dstSize;
704 float calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const;
857 float VertexCubeTextureCase::calculateLod (const Vec2& texScale, const Vec2& dstSize, int textureNdx) const argument
861 const Vec2 sizeRatio = texScale*srcSize / dstSize;
/external/deqp/modules/gles31/functional/
H A Des31fPrimitiveBoundingBoxTests.cpp3247 const tcu::IVec2 dstSize = (m_dst == TARGET_DEFAULT) ? (tcu::IVec2(m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight())) : (tcu::IVec2(FBO_SIZE, FBO_SIZE));
3252 << "dstSize = " << dstSize << "\n"
3261 const tcu::IVec2 unionSize = tcu::IVec2(de::min(srcSize.x(), dstSize.x()), de::min(srcSize.y(), dstSize.y()));
3280 const int dstWidth = rnd.getInt(1, dstSize.x());
3281 const int dstHeight = rnd.getInt(1, dstSize.y());
3282 const int dstX = rnd.getInt(-(dstWidth / 2), dstSize.x() - (dstWidth+1) / 2); // allow dst go out of bounds
3283 const int dstY = rnd.getInt(-(dstHeight / 2), dstSize.y() - (dstHeight+1) / 2);
3376 const tcu::IVec2 dstSize
[all...]
H A Des31fCopyImageTests.cpp1857 const IVec3 dstSize = getLevelSize(dstInfo.getTarget(), dstInfo.getSize(), dstLevel); local
1861 const IVec3 dstCompleteBlockSize = IVec3(dstSize.x() / dstBlockPixelSize.x(), dstSize.y() / dstBlockPixelSize.y(), (dstIsCube ? 6 : dstSize.z() / dstBlockPixelSize.z()));
2089 const IVec3 dstSize = getTestedSize(dstTarget, dstFormat, (dstIs3D ? targetSize3D : targetSize2D)); local
2093 ImageInfo(dstFormat, dstTarget, dstSize),
/external/skia/src/core/
H A DSkBitmap.cpp433 bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, argument
447 if (safeSize > dstSize || safeSize == 0)
460 if (fInfo.getSafeSize(dstRowBytes) > dstSize) {
/external/skia/include/core/
H A DSkBitmap.h319 @param dstSize Size of destination buffer. Must be large enough to hold
325 bool copyPixelsTo(void* const dst, size_t dstSize, size_t dstRowBytes = 0,
/external/skia/src/utils/
H A DSkTextureCompressor_ASTC.cpp763 int dstSize, // The maximum size of the array
774 if (nVals > dstSize) {
596 SkASSERT(nBits < 8); m[0] = static_cast<int>(blockBits(nBits - 1, 0)); m[1] = static_cast<int>(blockBits(2*nBits - 1 + 2, nBits + 2)); m[2] = static_cast<int>(blockBits(3*nBits - 1 + 4, 2*nBits + 4)); m[3] = static_cast<int>(blockBits(4*nBits - 1 + 5, 3*nBits + 5)); m[4] = static_cast<int>(blockBits(5*nBits - 1 + 7, 4*nBits + 7)); } int T = static_cast<int>(blockBits(nBits + 1, nBits)) | (static_cast<int>(blockBits(2*nBits + 2 + 1, 2*nBits + 2)) << 2) | (static_cast<int>(blockBits[3*nBits + 4] << 4)) | (static_cast<int>(blockBits(4*nBits + 5 + 1, 4*nBits + 5)) << 5) | (static_cast<int>(blockBits[5*nBits + 7] << 7)); int t[5]; int C; SkTBits<int> Tbits(T); if (0x7 == Tbits(4, 2)) { C = (Tbits(7, 5) << 2) | Tbits(1, 0); t[3] = t[4] = 2; } else { C = Tbits(4, 0); if (Tbits(6, 5) == 0x3) { t[4] = 2; t[3] = Tbits[7]; } else { t[4] = Tbits[7]; t[3] = Tbits(6, 5); } } SkTBits<int> Cbits(C); if (Cbits(1, 0) == 0x3) { t[2] = 2; t[1] = Cbits[4]; t[0] = (Cbits[3] << 1) | (Cbits[2] & (0x1 & ~(Cbits[3]))); } else if (Cbits(3, 2) == 0x3) { t[2] = 2; t[1] = 2; t[0] = Cbits(1, 0); } else { t[2] = Cbits[4]; t[1] = Cbits(3, 2); t[0] = (Cbits[1] << 1) | (Cbits[0] & (0x1 & ~(Cbits[1]))); } for (int i = 0; i < 5; ++i) { SkASSERT(t[i] < 3); SkASSERT(m[i] < (1 << nBits)); } for (int i = 0; i < 5; ++i) { *dst = (t[i] << nBits) + m[i]; ++dst; } } static void decode_quint_block(int* dst, int nBits, const uint64_t &block) { SkTBits<uint64_t> blockBits(block); int m[3]; if (0 == nBits) { memset(m, 0, sizeof(m)); } else { SkASSERT(nBits < 8); m[0] = static_cast<int>(blockBits(nBits - 1, 0)); m[1] = static_cast<int>(blockBits(2*nBits - 1 + 3, nBits + 3)); m[2] = static_cast<int>(blockBits(3*nBits - 1 + 5, 2*nBits + 5)); } int Q = static_cast<int>(blockBits(nBits + 2, nBits)) | (static_cast<int>(blockBits(2*nBits + 3 + 1, 2*nBits + 3)) << 3) | (static_cast<int>(blockBits(3*nBits + 5 + 1, 3*nBits + 5)) << 5); int q[3]; SkTBits<int> Qbits(Q); if (Qbits(2, 1) == 0x3 && Qbits(6, 5) == 0) { const int notBitZero = (0x1 & ~(Qbits[0])); q[2] = (Qbits[0] << 2) | ((Qbits[4] & notBitZero) << 1) | (Qbits[3] & notBitZero); q[1] = 4; q[0] = 4; } else { int C; if (Qbits(2, 1) == 0x3) { q[2] = 4; C = (Qbits(4, 3) << 3) | ((0x3 & ~(Qbits(6, 5))) << 1) | Qbits[0]; } else { q[2] = Qbits(6, 5); C = Qbits(4, 0); } SkTBits<int> Cbits(C); if (Cbits(2, 0) == 0x5) { q[1] = 4; q[0] = Cbits(4, 3); } else { q[1] = Cbits(4, 3); q[0] = Cbits(2, 0); } } for (int i = 0; i < 3; ++i) { SkASSERT(q[i] < 5); SkASSERT(m[i] < (1 << nBits)); } for (int i = 0; i < 3; ++i) { *dst = (q[i] << nBits) + m[i]; ++dst; } } static bool decode_integer_sequence( int* dst, int dstSize, int nVals, const ASTCBlock &block, int startBit, int endBit, bool bReadForward, int nBits, int nTrits, int nQuints ) { if (nVals > dstSize) { return false; } ASTCBlock src = block; if (!bReadForward) { src.reverse(); startBit = 128 - startBit; endBit = 128 - endBit; } while (nVals > 0) { if (nTrits > 0) { SkASSERT(0 == nQuints); int endBlockBit = startBit + 8 + 5*nBits; if (endBlockBit > endBit) { endBlockBit = endBit; } int trits[5]; decode_trit_block(trits, nBits, read_astc_bits(src, startBit, endBlockBit)); memcpy(dst, trits, SkMin32(nVals, 5)*sizeof(int)); dst += 5; nVals -= 5; startBit = endBlockBit; } else if (nQuints > 0) { SkASSERT(0 == nTrits); int endBlockBit = startBit + 7 + 3*nBits; if (endBlockBit > endBit) { endBlockBit = endBit; } int quints[3]; decode_quint_block(quints, nBits, read_astc_bits(src, startBit, endBlockBit)); memcpy(dst, quints, SkMin32(nVals, 3)*sizeof(int)); dst += 3; nVals -= 3; startBit = endBlockBit; } else { int endValBit = startBit + nBits; if (endValBit > endBit) { endValBit = endBit; } SkASSERT(endValBit - startBit < 31); *dst = static_cast<int>(read_astc_bits(src, startBit, endValBit)); ++dst; --nVals; startBit = endValBit; } } return true; } static inline int unquantize_value(unsigned mask, int A, int B, int C, int D) { int T = D * C + B; T = T ^ A; T = (A & mask) | (T >> 2); SkASSERT(T < 256); return T; } static inline int replicate_bits(int x, int oldPrec, int prec) { while (oldPrec < prec) { const int toShift = SkMin32(prec-oldPrec, oldPrec); x = (x << toShift) | (x >> (oldPrec - toShift)); oldPrec += toShift; } SkASSERT((-(1 << prec) & x) == 0); return x; } static inline int unquantize_bits_color(int val, int nBits) { return replicate_bits(val, nBits, 8); } static inline int unquantize_trit_color(int val, int nBits) { SkASSERT(nBits > 0); SkASSERT(nBits < 7); const int D = (val >> nBits) & 0x3; SkASSERT(D < 3); const int A = -(val & 0x1) & 0x1FF; static const int Cvals[6] = { 204, 93, 44, 22, 11, 5 }; const int C = Cvals[nBits - 1]; int B = 0; const SkTBits<int> valBits(val); switch (nBits) { case 1: B = 0; break; case 2: { const int b = valBits[1]; B = (b << 1) | (b << 2) | (b << 4) | (b << 8); } break; case 3: { const int cb = valBits(2, 1); B = cb | (cb << 2) | (cb << 7); } break; case 4: { const int dcb = valBits(3, 1); B = dcb | (dcb << 6); } break; case 5: { const int edcb = valBits(4, 1); B = (edcb << 5) | (edcb >> 2); } break; case 6: { const int fedcb = valBits(5, 1); B = (fedcb << 4) | (fedcb >> 4); } break; } return unquantize_value(0x80, A, B, C, D); } static inline int unquantize_quint_color(int val, int nBits) { const int D = (val >> nBits) & 0x7; SkASSERT(D < 5); const int A = -(val & 0x1) & 0x1FF; static const int Cvals[5] = { 113, 54, 26, 13, 6 }; SkASSERT(nBits > 0); SkASSERT(nBits < 6); const int C = Cvals[nBits - 1]; int B = 0; const SkTBits<int> valBits(val); switch (nBits) { case 1: B = 0; break; case 2: { const int b = valBits[1]; B = (b << 2) | (b << 3) | (b << 8); } break; case 3: { const int cb = valBits(2, 1); B = (cb >> 1) | (cb << 1) | (cb << 7); } break; case 4: { const int dcb = valBits(3, 1); B = (dcb >> 1) | (dcb << 6); } break; case 5: { const int edcb = valBits(4, 1); B = (edcb << 5) | (edcb >> 3); } break; } return unquantize_value(0x80, A, B, C, D); } static void unquantize_colors(int *vals, int nVals, int nBits, int nTrits, int nQuints) { for (int i = 0; i < nVals; ++i) { if (nTrits > 0) { SkASSERT(nQuints == 0); vals[i] = unquantize_trit_color(vals[i], nBits); } else if (nQuints > 0) { SkASSERT(nTrits == 0); vals[i] = unquantize_quint_color(vals[i], nBits); } else { SkASSERT(nQuints == 0 && nTrits == 0); vals[i] = unquantize_bits_color(vals[i], nBits); } } } static int interpolate_channel(int c0, int c1, int weight) { SkASSERT(0 <= c0 && c0 < 256); SkASSERT(0 <= c1 && c1 < 256); c0 = (c0 << 8) | c0; c1 = (c1 << 8) | c1; const int result = ((c0*(64 - weight) + c1*weight + 32) / 64) >> 8; if (result > 255) { return 255; } SkASSERT(result >= 0); return result; } static SkColor interpolate_endpoints(const SkColor endpoints[2], int weight) { return SkColorSetARGB( interpolate_channel(SkColorGetA(endpoints[0]), SkColorGetA(endpoints[1]), weight), interpolate_channel(SkColorGetR(endpoints[0]), SkColorGetR(endpoints[1]), weight), interpolate_channel(SkColorGetG(endpoints[0]), SkColorGetG(endpoints[1]), weight), interpolate_channel(SkColorGetB(endpoints[0]), SkColorGetB(endpoints[1]), weight)); } static SkColor interpolate_dual_endpoints( const SkColor endpoints[2], int weight0, int weight1, int plane) { int a = interpolate_channel(SkColorGetA(endpoints[0]), SkColorGetA(endpoints[1]), weight0); int r = interpolate_channel(SkColorGetR(endpoints[0]), SkColorGetR(endpoints[1]), weight0); int g = interpolate_channel(SkColorGetG(endpoints[0]), SkColorGetG(endpoints[1]), weight0); int b = interpolate_channel(SkColorGetB(endpoints[0]), SkColorGetB(endpoints[1]), weight0); switch (plane) { case 0: r = interpolate_channel( SkColorGetR(endpoints[0]), SkColorGetR(endpoints[1]), weight1); break; case 1: g = interpolate_channel( SkColorGetG(endpoints[0]), SkColorGetG(endpoints[1]), weight1); break; case 2: b = interpolate_channel( SkColorGetB(endpoints[0]), SkColorGetB(endpoints[1]), weight1); break; case 3: a = interpolate_channel( SkColorGetA(endpoints[0]), SkColorGetA(endpoints[1]), weight1); break; default: SkDEBUGFAIL(�); break; } return SkColorSetARGB(a, r, g, b); } struct ASTCDecompressionData { ASTCDecompressionData(int dimX, int dimY) : fDimX(dimX), fDimY(dimY) { } const int fDimX; const int fDimY; ASTCBlock fBlock; int fBlockMode; bool fDualPlaneEnabled; int fDualPlane; bool fVoidExtent; bool fError; int fWeightDimX; int fWeightDimY; int fWeightBits; int fWeightTrits; int fWeightQuints; int fPartCount; int fPartIndex; enum ColorEndpointMode { kLDR_Luminance_Direct_ColorEndpointMode = 0, kLDR_Luminance_BaseOffset_ColorEndpointMode = 1, kHDR_Luminance_LargeRange_ColorEndpointMode = 2, kHDR_Luminance_SmallRange_ColorEndpointMode = 3, kLDR_LuminanceAlpha_Direct_ColorEndpointMode = 4, kLDR_LuminanceAlpha_BaseOffset_ColorEndpointMode = 5, kLDR_RGB_BaseScale_ColorEndpointMode = 6, kHDR_RGB_BaseScale_ColorEndpointMode = 7, kLDR_RGB_Direct_ColorEndpointMode = 8, kLDR_RGB_BaseOffset_ColorEndpointMode = 9, kLDR_RGB_BaseScaleWithAlpha_ColorEndpointMode = 10, kHDR_RGB_ColorEndpointMode = 11, kLDR_RGBA_Direct_ColorEndpointMode = 12, kLDR_RGBA_BaseOffset_ColorEndpointMode = 13, kHDR_RGB_LDRAlpha_ColorEndpointMode = 14, kHDR_RGB_HDRAlpha_ColorEndpointMode = 15 }; static const int kMaxColorEndpointModes = 16; static const int kMaxPartitions = 4; ColorEndpointMode fCEM[kMaxPartitions]; int fColorStartBit; int fColorEndBit; int numPartitions() const { return fPartCount; } int numWeights() const { return fWeightDimX * fWeightDimY * (fDualPlaneEnabled ? 2 : 1); } int maxWeightValue() const { int maxVal = (1 << fWeightBits); if (fWeightTrits > 0) { SkASSERT(0 == fWeightQuints); maxVal *= 3; } else if (fWeightQuints > 0) { SkASSERT(0 == fWeightTrits); maxVal *= 5; } return maxVal - 1; } int numWeightBits() const { const int nWeights = this->numWeights(); return ((nWeights*8*fWeightTrits + 4) / 5) + ((nWeights*7*fWeightQuints + 2) / 3) + (nWeights*fWeightBits); } int numColorValues() const { int numValues = 0; for (int i = 0; i < this->numPartitions(); ++i) { int cemInt = static_cast<int>(fCEM[i]); numValues += ((cemInt >> 2) + 1) * 2; } return numValues; } bool getColorValueEncoding(int *nBits, int *nTrits, int *nQuints) const { if (NULL == nBits || NULL == nTrits || NULL == nQuints) { return false; } const int nColorVals = this->numColorValues(); if (nColorVals <= 0) { return false; } const int colorBits = fColorEndBit - fColorStartBit; SkASSERT(colorBits > 0); if (colorBits < ((13 * nColorVals + 4) / 5)) { return false; } for (int i = 255; i > 0; --i) { int range = i + 1; int bits = 0, trits = 0, quints = 0; bool valid = false; if (SkIsPow2(range)) { bits = bits_for_range(range); valid = true; } else if ((range % 3) == 0 && SkIsPow2(range/3)) { trits = 1; bits = bits_for_range(range/3); valid = true; } else if ((range % 5) == 0 && SkIsPow2(range/5)) { quints = 1; bits = bits_for_range(range/5); valid = true; } if (valid) { const int actualColorBits = ((nColorVals*8*trits + 4) / 5) + ((nColorVals*7*quints + 2) / 3) + (nColorVals*bits); if (actualColorBits <= colorBits) { *nTrits = trits; *nQuints = quints; *nBits = bits; return true; } } } return false; } void colorEndpoints(SkColor endpoints[4][2], const int* colorValues) const { for (int i = 0; i < this->numPartitions(); ++i) { switch (fCEM[i]) { case kLDR_Luminance_Direct_ColorEndpointMode: { const int* v = colorValues; endpoints[i][0] = SkColorSetARGB(0xFF, v[0], v[0], v[0]); endpoints[i][1] = SkColorSetARGB(0xFF, v[1], v[1], v[1]); colorValues += 2; } break; case kLDR_Luminance_BaseOffset_ColorEndpointMode: { const int* v = colorValues; const int L0 = (v[0] >> 2) | (v[1] & 0xC0); const int L1 = clamp_byte(L0 + (v[1] & 0x3F)); endpoints[i][0] = SkColorSetARGB(0xFF, L0, L0, L0); endpoints[i][1] = SkColorSetARGB(0xFF, L1, L1, L1); colorValues += 2; } break; case kLDR_LuminanceAlpha_Direct_ColorEndpointMode: { const int* v = colorValues; endpoints[i][0] = SkColorSetARGB(v[2], v[0], v[0], v[0]); endpoints[i][1] = SkColorSetARGB(v[3], v[1], v[1], v[1]); colorValues += 4; } break; case kLDR_LuminanceAlpha_BaseOffset_ColorEndpointMode: { int v0 = colorValues[0]; int v1 = colorValues[1]; int v2 = colorValues[2]; int v3 = colorValues[3]; bit_transfer_signed(&v1, &v0); bit_transfer_signed(&v3, &v2); endpoints[i][0] = SkColorSetARGB(v2, v0, v0, v0); endpoints[i][1] = SkColorSetARGB( clamp_byte(v3+v2), clamp_byte(v1+v0), clamp_byte(v1+v0), clamp_byte(v1+v0)); colorValues += 4; } break; case kLDR_RGB_BaseScale_ColorEndpointMode: { decode_rgba_basescale(colorValues, endpoints[i], true); colorValues += 4; } break; case kLDR_RGB_Direct_ColorEndpointMode: { decode_rgba_direct(colorValues, endpoints[i], true); colorValues += 6; } break; case kLDR_RGB_BaseOffset_ColorEndpointMode: { decode_rgba_baseoffset(colorValues, endpoints[i], true); colorValues += 6; } break; case kLDR_RGB_BaseScaleWithAlpha_ColorEndpointMode: { decode_rgba_basescale(colorValues, endpoints[i], false); colorValues += 6; } break; case kLDR_RGBA_Direct_ColorEndpointMode: { decode_rgba_direct(colorValues, endpoints[i], false); colorValues += 8; } break; case kLDR_RGBA_BaseOffset_ColorEndpointMode: { decode_rgba_baseoffset(colorValues, endpoints[i], false); colorValues += 8; } break; default: SkDEBUGFAIL(�); break; } } } int unquantizeWeight(int x) const { SkASSERT(x <= this->maxWeightValue()); const int D = (x >> fWeightBits) & 0x7; const int A = -(x & 0x1) & 0x7F; SkTBits<int> xbits(x); int T = 0; if (fWeightTrits > 0) { SkASSERT(0 == fWeightQuints); switch (fWeightBits) { case 0: { SkASSERT(x < 3); static const int kUnquantizationTable[3] = { 0, 32, 63 }; T = kUnquantizationTable[x]; } break; case 1: { const int B = 0; const int C = 50; T = unquantize_value(0x20, A, B, C, D); } break; case 2: { const int b = xbits[1]; const int B = b | (b << 2) | (b << 6); const int C = 23; T = unquantize_value(0x20, A, B, C, D); } break; case 3: { const int cb = xbits(2, 1); const int B = cb | (cb << 5); const int C = 11; T = unquantize_value(0x20, A, B, C, D); } break; default: SkDEBUGFAIL(�); break; } } else if (fWeightQuints > 0) { SkASSERT(0 == fWeightTrits); switch (fWeightBits) { case 0: { SkASSERT(x < 5); static const int kUnquantizationTable[5] = { 0, 16, 32, 47, 63 }; T = kUnquantizationTable[x]; } break; case 1: { const int B = 0; const int C = 28; T = unquantize_value(0x20, A, B, C, D); } break; case 2: { const int b = xbits[1]; const int B = (b << 1) | (b << 6); const int C = 13; T = unquantize_value(0x20, A, B, C, D); } break; default: SkDEBUGFAIL(�); break; } } else { SkASSERT(0 == fWeightTrits); SkASSERT(0 == fWeightQuints); T = replicate_bits(x, fWeightBits, 6); } SkASSERT(T <= 63); if (T > 32) { T += 1; } SkASSERT(T <= 64); return T; } int getWeight(const int* unquantizedWeights, int idx, bool dualPlane) const { const int maxIdx = (fDualPlaneEnabled ? 2 : 1) * fWeightDimX * fWeightDimY - 1; if (fDualPlaneEnabled) { const int effectiveIdx = 2*idx + (dualPlane ? 1 : 0); if (effectiveIdx > maxIdx) { return 0; } return unquantizedWeights[effectiveIdx]; } SkASSERT(!dualPlane); if (idx > maxIdx) { return 0; } else { return unquantizedWeights[idx]; } } int infillWeight(const int* unquantizedValues, int s, int t, bool dualPlane) const { const int Ds = (1024 + fDimX/2) / (fDimX - 1); const int Dt = (1024 + fDimY/2) / (fDimY - 1); const int cs = Ds * s; const int ct = Dt * t; const int gs = (cs*(fWeightDimX - 1) + 32) >> 6; const int gt = (ct*(fWeightDimY - 1) + 32) >> 6; const int js = gs >> 4; const int jt = gt >> 4; const int fs = gs & 0xF; const int ft = gt & 0xF; const int idx = js + jt*fWeightDimX; const int p00 = this->getWeight(unquantizedValues, idx, dualPlane); const int p01 = this->getWeight(unquantizedValues, idx + 1, dualPlane); const int p10 = this->getWeight(unquantizedValues, idx + fWeightDimX, dualPlane); const int p11 = this->getWeight(unquantizedValues, idx + fWeightDimX + 1, dualPlane); const int w11 = (fs*ft + 8) >> 4; const int w10 = ft - w11; const int w01 = fs - w11; const int w00 = 16 - fs - ft + w11; const int weight = (p00*w00 + p01*w01 + p10*w10 + p11*w11 + 8) >> 4; SkASSERT(weight <= 64); return weight; } void texelWeights(int texelWeights[2][12][12], const int* texelValues) const { int unquantizedValues[144*2]; SkASSERT(this->numWeights() <= 144*2); for (int j = 0; j < this->numWeights(); ++j) { unquantizedValues[j] = this->unquantizeWeight(texelValues[j]); } for (int y = 0; y < fDimY; ++y) { for (int x = 0; x < fDimX; ++x) { texelWeights[0][x][y] = this->infillWeight(unquantizedValues, x, y, false); if (fDualPlaneEnabled) { texelWeights[1][x][y] = this->infillWeight(unquantizedValues, x, y, true); } } } } int getPartition(int x, int y) const { const int partitionCount = this->numPartitions(); int seed = fPartIndex; if ((fDimX * fDimY) < 31) { x <<= 1; y <<= 1; } seed += (partitionCount - 1) * 1024; uint32_t p = seed; p ^= p >> 15; p -= p << 17; p += p << 7; p += p << 4; p ^= p >> 5; p += p << 16; p ^= p >> 7; p ^= p >> 3; p ^= p << 6; p ^= p >> 17; uint32_t rnum = p; uint8_t seed1 = rnum & 0xF; uint8_t seed2 = (rnum >> 4) & 0xF; uint8_t seed3 = (rnum >> 8) & 0xF; uint8_t seed4 = (rnum >> 12) & 0xF; uint8_t seed5 = (rnum >> 16) & 0xF; uint8_t seed6 = (rnum >> 20) & 0xF; uint8_t seed7 = (rnum >> 24) & 0xF; uint8_t seed8 = (rnum >> 28) & 0xF; uint8_t seed9 = (rnum >> 18) & 0xF; uint8_t seed10 = (rnum >> 22) & 0xF; uint8_t seed11 = (rnum >> 26) & 0xF; uint8_t seed12 = ((rnum >> 30) | (rnum << 2)) & 0xF; seed1 *= seed1; seed2 *= seed2; seed3 *= seed3; seed4 *= seed4; seed5 *= seed5; seed6 *= seed6; seed7 *= seed7; seed8 *= seed8; seed9 *= seed9; seed10 *= seed10; seed11 *= seed11; seed12 *= seed12; int sh1, sh2, sh3; if (0 != (seed & 1)) { sh1 = (0 != (seed & 2))? 4 : 5; sh2 = (partitionCount == 3)? 6 : 5; } else { sh1 = (partitionCount==3)? 6 : 5; sh2 = (0 != (seed & 2))? 4 : 5; } sh3 = (0 != (seed & 0x10))? sh1 : sh2; seed1 >>= sh1; seed2 >>= sh2; seed3 >>= sh1; seed4 >>= sh2; seed5 >>= sh1; seed6 >>= sh2; seed7 >>= sh1; seed8 >>= sh2; seed9 >>= sh3; seed10 >>= sh3; seed11 >>= sh3; seed12 >>= sh3; const int z = 0; int a = seed1*x + seed2*y + seed11*z + (rnum >> 14); int b = seed3*x + seed4*y + seed12*z + (rnum >> 10); int c = seed5*x + seed6*y + seed9 *z + (rnum >> 6); int d = seed7*x + seed8*y + seed10*z + (rnum >> 2); a &= 0x3F; b &= 0x3F; c &= 0x3F; d &= 0x3F; if (partitionCount < 4) { d = 0; } if (partitionCount < 3) { c = 0; } if (a >= b && a >= c && a >= d) argument

Completed in 654 milliseconds