From a5f43663875e789baa8b7d9e79d5da4b3362f04a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 10 Sep 2016 22:18:05 -0400 Subject: IMAGE: Fix leading spaces into tabs in Indeo decoders --- image/codecs/indeo/vlc.cpp | 183 +++++++++++++++++++++++---------------------- 1 file changed, 93 insertions(+), 90 deletions(-) (limited to 'image/codecs/indeo/vlc.cpp') diff --git a/image/codecs/indeo/vlc.cpp b/image/codecs/indeo/vlc.cpp index e526a0998a..5b9e96cd96 100644 --- a/image/codecs/indeo/vlc.cpp +++ b/image/codecs/indeo/vlc.cpp @@ -41,97 +41,97 @@ namespace Indeo { * happen with non constructed input. */ #define AV_QSORT(p, num, type, cmp) do {\ - void *stack[64][2];\ - int sp = 1;\ - stack[0][0] = p;\ - stack[0][1] = (p)+(num)-1;\ - while(sp){\ - type *start = (type *)stack[--sp][0];\ - type *end = (type *)stack[ sp][1];\ - while (start < end) {\ - if (start < end-1) {\ - int checksort = 0;\ - type *right = end - 2;\ - type *left = start + 1;\ - type *mid = start + ((end - start) >> 1);\ - if(cmp(start, end) > 0) {\ - if(cmp( end, mid) > 0) SWAP(*start, *mid);\ - else SWAP(*start, *end);\ - } else {\ - if(cmp(start, mid) > 0) SWAP(*start, *mid);\ - else checksort = 1;\ - }\ - if (cmp(mid, end) > 0) { \ - SWAP(*mid, *end);\ - checksort = 0;\ - }\ - if(start == end - 2) break;\ - SWAP(end[-1], *mid);\ - while (left <= right) {\ - while (left<=right && cmp(left, end - 1) < 0)\ - left++;\ - while (left<=right && cmp(right, end - 1) > 0)\ - right--;\ - if (left <= right) {\ - SWAP(*left, *right);\ - left++;\ - right--;\ - }\ - }\ - SWAP(end[-1], *left);\ - if(checksort && (mid == left - 1 || mid == left)){\ - mid= start;\ - while(mid 0)\ - SWAP(*start, *end);\ - break;\ - }\ - }\ - }\ + void *stack[64][2];\ + int sp = 1;\ + stack[0][0] = p;\ + stack[0][1] = (p)+(num)-1;\ + while(sp){\ + type *start = (type *)stack[--sp][0];\ + type *end = (type *)stack[ sp][1];\ + while (start < end) {\ + if (start < end-1) {\ + int checksort = 0;\ + type *right = end - 2;\ + type *left = start + 1;\ + type *mid = start + ((end - start) >> 1);\ + if(cmp(start, end) > 0) {\ + if(cmp( end, mid) > 0) SWAP(*start, *mid);\ + else SWAP(*start, *end);\ + } else {\ + if(cmp(start, mid) > 0) SWAP(*start, *mid);\ + else checksort = 1;\ + }\ + if (cmp(mid, end) > 0) { \ + SWAP(*mid, *end);\ + checksort = 0;\ + }\ + if(start == end - 2) break;\ + SWAP(end[-1], *mid);\ + while (left <= right) {\ + while (left<=right && cmp(left, end - 1) < 0)\ + left++;\ + while (left<=right && cmp(right, end - 1) > 0)\ + right--;\ + if (left <= right) {\ + SWAP(*left, *right);\ + left++;\ + right--;\ + }\ + }\ + SWAP(end[-1], *left);\ + if(checksort && (mid == left - 1 || mid == left)){\ + mid= start;\ + while(mid 0)\ + SWAP(*start, *end);\ + break;\ + }\ + }\ + }\ } while (0) #define COPY(condition)\ - for (i = 0; i < nbCodes; i++) { \ - buf[j].bits = getData(p_bits, i, bitsWrap, bitsSize); \ - if (!(condition)) \ - continue; \ - if (buf[j].bits > (3 * nbBits) || buf[j].bits > 32) { \ - warning("Too long VLC (%d) in init_vlc", buf[j].bits); \ - if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ - free(buf); \ - return -1; \ - } \ - buf[j].code = getData(codes, i, codesWrap, codesSize); \ - if (buf[j].code >= (1LL << buf[j].bits)) { \ - warning("Invalid code %x for %d in init_vlc", buf[j].code, i); \ - if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ - free(buf); \ - return -1; \ - } \ - if (flags & INIT_VLC_LE) \ - buf[j].code = bitswap32(buf[j].code); \ - else \ - buf[j].code <<= 32 - buf[j].bits; \ - if (symbols) \ - buf[j].symbol = getData(symbols, i, symbolsWrap, symbolsSize); \ - else \ - buf[j].symbol = i; \ - j++; \ - } + for (i = 0; i < nbCodes; i++) { \ + buf[j].bits = getData(p_bits, i, bitsWrap, bitsSize); \ + if (!(condition)) \ + continue; \ + if (buf[j].bits > (3 * nbBits) || buf[j].bits > 32) { \ + warning("Too long VLC (%d) in init_vlc", buf[j].bits); \ + if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ + free(buf); \ + return -1; \ + } \ + buf[j].code = getData(codes, i, codesWrap, codesSize); \ + if (buf[j].code >= (1LL << buf[j].bits)) { \ + warning("Invalid code %x for %d in init_vlc", buf[j].code, i); \ + if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ + free(buf); \ + return -1; \ + } \ + if (flags & INIT_VLC_LE) \ + buf[j].code = bitswap32(buf[j].code); \ + else \ + buf[j].code <<= 32 - buf[j].bits; \ + if (symbols) \ + buf[j].symbol = getData(symbols, i, symbolsWrap, symbolsSize); \ + else \ + buf[j].symbol = i; \ + j++; \ + } /*------------------------------------------------------------------------*/ @@ -313,20 +313,23 @@ int VLC::allocTable(int size, int useStatic) { memset(vlc->_table + vlc->_tableAllocated - (1 << vlc->_bits), 0, sizeof(VLC_TYPE) * 2 << vlc->_bits); } + return index; } uint VLC::getData(const void *table, uint idx, uint wrap, uint size) { - const uint8 *ptr = (const uint8 *)table + idx * wrap; + const uint8 *ptr = (const uint8 *)table + idx * wrap; switch(size) { case 1: return *(const uint8 *)ptr; + case 2: return *(const uint16 *)ptr; + default: return *(const uint32 *)ptr; - } + } } } // End of namespace Indeo -- cgit v1.2.3