⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filterhpa.cpp

📁 HP喷墨打印机驱动代码 HP内部资料! 珍贵 珍贵 珍贵
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                | |                | |                 -  we have two 1x2s.                 -                | |                | |                 -            */            ASSERT(fPixelFilteredFlags[0][pixelNum] == e12);            ASSERT(fPixelFilteredFlags[1][pixelNum] == e12);            upPixel = get4Pixel(row1Ptr);            currPixel = get4Pixel(row3Ptr);            R1 = GetRed(currPixel);            G1 = GetGreen(currPixel);            B1 = GetBlue(currPixel);            R0 = GetRed(upPixel);            G0 = GetGreen(upPixel);            B0 = GetBlue(upPixel);            if ((maxErrorForFourPixels >= 3) && (NewDeltaE(R1, R0, G1, G0, B1, B0, maxErrorForFourPixels)))            {                /*   -                    | |                    | | build 1x4                    | |                    | |                     -                */#if kGatherStats == 1                blockStats[es14n]++;#endif                AverageNRound((pixelNum & 0x01) == 0x01, R1, R1, R0, G1, G1, G0, B1, B1, B0);                if(littleEndian)                    currPixel = (R1<<16) + (G1<<8) + B1;                else if(bigEndian)                    currPixel = (R1<<24) + (G1<<16) + (B1<<8);#if kMemWritesOptimize == 0                put4Pixel(row1Ptr, 0, currPixel);                put4Pixel(row2Ptr, 0, currPixel);                put4Pixel(row3Ptr, 0, currPixel);                put4Pixel(row4Ptr, 0, currPixel);#else                put4Pixel(row1Ptr, 0, currPixel);#endif                fPixelFilteredFlags[0][pixelNum] = e14n;                fPixelFilteredFlags[1][pixelNum] = e14s;            }            row1Ptr += eBufferedPixelWidthInBytes;            row2Ptr += eBufferedPixelWidthInBytes;            row3Ptr += eBufferedPixelWidthInBytes;            row4Ptr += eBufferedPixelWidthInBytes;            pixelNum++;        }        else if ((fPixelFilteredFlags[0][pixelNum] & e41si)            && (fPixelFilteredFlags[1][pixelNum] & e41ni))        {            /*    - - - -                 |       |                  - - - -   We have two 4x1s.                  - - - -                 |       |                  - - - -            */            upPixel = get4Pixel(row2Ptr);            currPixel = get4Pixel(row3Ptr);            R1 = GetRed(currPixel);            G1 = GetGreen(currPixel);            B1 = GetBlue(currPixel);            R0 = GetRed(upPixel);            G0 = GetGreen(upPixel);            B0 = GetBlue(upPixel);            if ((maxErrorForEightPixels >= 3) && (NewDeltaE(R1, R0, G1, G0, B1, B0, maxErrorForEightPixels)))            {                /*    - - - -                     |       |  build 4x2.                     |       |                      - - - -                */#if kGatherStats == 1                blockStats[es42w]++;#endif                AverageNRound((pixelNum & 0x04) == 0x04, R1, R1, R0, G1, G1, G0, B1, B1, B0);                if(littleEndian)                    currPixel = (R1<<16) + (G1<<8) + B1;                else if(bigEndian)                    currPixel = (R1<<24) + (G1<<16) + (B1<<8);                // Note we write this block out now and do not delay the writes for the postprocessing step since we do not track this block.                put4Pixel(row2Ptr, 0, currPixel);                put4Pixel(row2Ptr, 1, currPixel);                put4Pixel(row2Ptr, 2, currPixel);                put4Pixel(row2Ptr, 3, currPixel);                put4Pixel(row3Ptr, 0, currPixel);                put4Pixel(row3Ptr, 1, currPixel);                put4Pixel(row3Ptr, 2, currPixel);                put4Pixel(row3Ptr, 3, currPixel);                fPixelFilteredFlags[0][pixelNum] = fPixelFilteredFlags[0][pixelNum] & ~e41si;                fPixelFilteredFlags[0][pixelNum+1] = fPixelFilteredFlags[0][pixelNum+1] & ~e41s;                fPixelFilteredFlags[0][pixelNum+2] = fPixelFilteredFlags[0][pixelNum+1] & ~e41s;                fPixelFilteredFlags[0][pixelNum+3] = fPixelFilteredFlags[0][pixelNum+1] & ~e41s;                fPixelFilteredFlags[1][pixelNum] = fPixelFilteredFlags[1][pixelNum] & ~e41ni;  // Note that we just formed a 2x2 in the middle of the filtered sets of rows (and do not remember it). We then remove the 2x1s that the 2x2 eliminated.                fPixelFilteredFlags[1][pixelNum+1] = fPixelFilteredFlags[1][pixelNum+1] & ~e41n;                fPixelFilteredFlags[1][pixelNum+2] = fPixelFilteredFlags[1][pixelNum+1] & ~e41n;                fPixelFilteredFlags[1][pixelNum+3] = fPixelFilteredFlags[1][pixelNum+1] & ~e41n;            }            pixelNum += 4;            row1Ptr += 4*eBufferedPixelWidthInBytes;            row2Ptr += 4*eBufferedPixelWidthInBytes;            row3Ptr += 4*eBufferedPixelWidthInBytes;            row4Ptr += 4*eBufferedPixelWidthInBytes;        }        else if ((fPixelFilteredFlags[0][pixelNum] & e21sw)                && (fPixelFilteredFlags[1][pixelNum] & e21nw))        {            /*    - -                 |   |                  - -  We have two 2x1s.                  - -                 |   |                  - -            */            ASSERT(!((fPixelFilteredFlags[0][pixelNum] & e11s) | (fPixelFilteredFlags[0][pixelNum+1] & e11s)));            ASSERT(!((fPixelFilteredFlags[1][pixelNum] & e11n) | (fPixelFilteredFlags[1][pixelNum+1] & e11n)));            upPixel = get4Pixel(row2Ptr);            currPixel = get4Pixel(row3Ptr);            R1 = GetRed(currPixel);            G1 = GetGreen(currPixel);            B1 = GetBlue(currPixel);            R0 = GetRed(upPixel);            G0 = GetGreen(upPixel);            B0 = GetBlue(upPixel);            if ((maxErrorForFourPixels >= 3) && (NewDeltaE(R1, R0, G1, G0, B1, B0, maxErrorForFourPixels)))            {                /*    - -                     |   |  build 2x2.                     |   |                      - -                */#if kGatherStats == 1                blockStats[es22w]++;#endif                AverageNRound((pixelNum & 0x02) == 0x02, R1, R1, R0, G1, G1, G0, B1, B1, B0);                if(littleEndian)                    currPixel = (R1<<16) + (G1<<8) + B1;                else if(bigEndian)                    currPixel = (R1<<24) + (G1<<16) + (B1<<8);                // Note we write this block out now and do not delay the writes for the postprocessing step since we do not track this block.                put4Pixel(row2Ptr, 0, currPixel);                put4Pixel(row2Ptr, 1, currPixel);                put4Pixel(row3Ptr, 0, currPixel);                put4Pixel(row3Ptr, 1, currPixel);                fPixelFilteredFlags[0][pixelNum] = fPixelFilteredFlags[0][pixelNum] & ~e21sw;                fPixelFilteredFlags[0][pixelNum+1] = fPixelFilteredFlags[0][pixelNum+1] & ~e21se;                fPixelFilteredFlags[1][pixelNum] = fPixelFilteredFlags[1][pixelNum] & ~e21nw;  // Note that we just formed a 2x2 in the middle of the filtered sets of rows (and do not remember it). We then remove the 2x1s that the 2x2 eliminated.                fPixelFilteredFlags[1][pixelNum+1] = fPixelFilteredFlags[1][pixelNum+1] & ~e21ne;            }            pixelNum += 2;            row1Ptr += 2*eBufferedPixelWidthInBytes;            row2Ptr += 2*eBufferedPixelWidthInBytes;            row3Ptr += 2*eBufferedPixelWidthInBytes;            row4Ptr += 2*eBufferedPixelWidthInBytes;        }        else if ((fPixelFilteredFlags[0][pixelNum] & e11s)                && (fPixelFilteredFlags[1][pixelNum] & e11n))        {            /*    -                 | |                  -   We have two 1x1s.                  -                 | |                  -            */            upPixel = get4Pixel(row2Ptr);            currPixel = get4Pixel(row3Ptr);            R1 = GetRed(currPixel);            G1 = GetGreen(currPixel);            B1 = GetBlue(currPixel);            R0 = GetRed(upPixel);            G0 = GetGreen(upPixel);            B0 = GetBlue(upPixel);            if ((fMaxErrorForTwoPixels >= 3) && (NewDeltaE(R1, R0, G1, G0, B1, B0, fMaxErrorForTwoPixels)))            {                /*    -                     | |  build 1x2.                     | |                      -                */#if kGatherStats == 1                blockStats[es12w]++;#endif                AverageNRound(isOdd(pixelNum), R1, R1, R0, G1, G1, G0, B1, B1, B0);                if(littleEndian)                    currPixel = (R1<<16) + (G1<<8) + B1;                else if(bigEndian)                    currPixel = (R1<<24) + (G1<<16) + (B1<<8);                // Note we write this block out now and do not delay the writes for the postprocessing step since we do not track this block.                put4Pixel(row2Ptr, 0, currPixel);                put4Pixel(row3Ptr, 0, currPixel);                fPixelFilteredFlags[0][pixelNum] = fPixelFilteredFlags[0][pixelNum] & ~e11s;                fPixelFilteredFlags[1][pixelNum] = fPixelFilteredFlags[1][pixelNum] & ~e11n;  // Note that we just formed a 2x2 in the middle of the filtered sets of rows (and do not remember it). We then remove the 2x1s that the 2x2 eliminated.            }            pixelNum += 1;            row1Ptr += eBufferedPixelWidthInBytes;            row2Ptr += eBufferedPixelWidthInBytes;            row3Ptr += eBufferedPixelWidthInBytes;            row4Ptr += eBufferedPixelWidthInBytes;        }        else // Do no vertical filtering here.        {            pixelNum += 1;            row1Ptr += eBufferedPixelWidthInBytes;            row2Ptr += eBufferedPixelWidthInBytes;            row3Ptr += eBufferedPixelWidthInBytes;            row4Ptr += eBufferedPixelWidthInBytes;        }    }}// Filter3FilteredRows.  This routine only exists for the case of the odd size band// with three rasters left over.  I'm not sure how much extra benifit we really// get from running this, but for now I'm leaving it in.  Since Ernie deals with// block sizes that are powers of two its rather difficult to filter 3 rows together,// about all I've been able to do is look for 1 high blocks in the second and third// rasters to put together into 2 high blocks.  This routine will create 4x2, 2x2, and// 1x2 blocks from those second and third rasters.void TErnieFilter::Filter3FilteredRows(unsigned char *row1Ptr, unsigned char *row2Ptr, unsigned char *row3Ptr){    const unsigned int maxErrorForFourPixels = fMaxErrorForTwoPixels / 2;    const unsigned int maxErrorForEightPixels = maxErrorForFourPixels / 2;//    const unsigned int maxErrorForSixteenPixels = maxErrorForEightPixels / 2;//    const unsigned int maxErrorForThirtyTwoPixels = maxErrorForSixteenPixels / 2;    for (int pixelNum = 0; pixelNum < (fRowWidthInPixels-3);)  // Make sure we have four pixels to work with    {//        int currPixel, upPixel;        uint32_t currPixel, upPixel;        int R0, G0, B0, R1, G1, B1;        if ((fPixelFilteredFlags[0][pixelNum] & e41si)                && (fPixelFilteredFlags[1][pixelNum] & e41ni))        {            /*    - - - -                 |       |                  - - - -   We have two 4x1s.                  - - - -                 |       |                  - - - -            */            ASSERT(!((fPixelFilteredFlags[0][pixelNum] & e11s) | (fPixelFilteredFlags[0][pixelNum+1] & e11s)));            ASSERT(!((fPixelFilteredFlags[1][pixelNum] & e11n) | (fPixelFilteredFlags[1][pixelNum+1] & e11n)));            upPixel = get4Pixel(row2Ptr);            currPixel = get4Pixel(row3Ptr);            R1 = GetRed(currPixel);            G1 = GetGreen(currPixel);            B1 = GetBlue(currPixel);            R0 = GetRed(upPixel);            G0 = GetGreen(upPixel);            B0 = GetBlue(upPixel);            if ((maxErrorForEightPixels >= 3) && (NewDeltaE(R1, R0, G1, G0, B1, B0, maxErrorForEightPixels)))            {                /*    - - - -                     |       |  build 4x2.                     |       |                      - - - -                */#if kGatherStats == 1                blockStats[es42w]++;#endif                AverageNRound((pixelNum & 0x04) == 0x04, R1, R1, R0, G1, G1, G0, B1, B1, B0);                if(littleEndian)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -