MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / getCode

Function getCode

Source/ThirdParty/tinyexr.h:2889–2922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2887 }
2888#else
2889static bool getCode(int po, int rlc, long long &c, int &lc, const char *&in,
2890 const char *in_end, unsigned short *&out,
2891 const unsigned short *ob, const unsigned short *oe) {
2892 (void)ob;
2893 if (po == rlc) {
2894 if (lc < 8) {
2895 /* TinyEXR issue 78 */
2896 /* TinyEXR issue 160. in + 1 -> in */
2897 if (in >= in_end) {
2898 return false;
2899 }
2900
2901 getChar(c, lc, in);
2902 }
2903
2904 lc -= 8;
2905
2906 unsigned char cs = (c >> lc);
2907
2908 if (out + cs > oe) return false;
2909
2910 // Bounds check for safety
2911 // Issue 100.
2912 if ((out - 1) < ob) return false;
2913 unsigned short s = out[-1];
2914
2915 while (cs-- > 0) *out++ = s;
2916 } else if (out < oe) {
2917 *out++ = po;
2918 } else {
2919 return false;
2920 }
2921 return true;
2922}
2923#endif
2924
2925//

Callers 1

hufDecodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected