Ticket #832: crc_bug.patch
File crc_bug.patch, 1.4 KB (added by bheng, 11 years ago) |
---|
-
source/Lib/TLibCommon/TComPicYuvMD5.cpp
85 85 86 86 static void compCRC(Int bitdepth, const Pel* plane, UInt width, UInt height, UInt stride, UChar digest[16]) 87 87 { 88 UInt dataMsbIdx = bitdepth - 1;89 88 UInt crcMsb; 90 89 UInt bitVal; 91 90 UInt crcVal = 0xffff; … … 93 92 for (UInt y = 0; y < height; y++) 94 93 { 95 94 for (UInt x = 0; x < width; x++) 96 { 97 for(bitIdx=0; bitIdx<bitdepth; bitIdx++) 95 { 96 // take CRC of first pictureData byte 97 for(bitIdx=0; bitIdx<8; bitIdx++) 98 98 { 99 99 crcMsb = (crcVal >> 15) & 1; 100 bitVal = (plane[y*stride+x] >> (dataMsbIdx - (bitIdx&dataMsbIdx))) & 1;100 bitVal = (plane[y*stride+x] >> (7 - bitIdx)) & 1; 101 101 crcVal = (((crcVal << 1) + bitVal) & 0xffff) ^ (crcMsb * 0x1021); 102 102 } 103 // take CRC of second pictureData byte if bit depth is greater than 8-bits 104 if(bitdepth > 8) 105 { 106 for(bitIdx=0; bitIdx<8; bitIdx++) 107 { 108 crcMsb = (crcVal >> 15) & 1; 109 bitVal = (plane[y*stride+x] >> (15 - bitIdx)) & 1; 110 crcVal = (((crcVal << 1) + bitVal) & 0xffff) ^ (crcMsb * 0x1021); 111 } 112 } 103 113 } 104 114 } 105 115 for(bitIdx=0; bitIdx<16; bitIdx++)