src/main/java/org/jcodec/codecs/h264/decode/BlockInterpolator.java
static void getLuma02UnsafeNoRound(byte[] pic, int picW, int picH, int[] blk, int blkOff, int blkStride, int x,
            int y, int blkW, int blkH) {
        int maxH = picH - 1;
        int maxW = picW - 1;

        for (int j = 0; j < blkH; j++) {
            int offP0 = clip(y + j - 2, 0, maxH) * picW;
            int offP1 = clip(y + j - 1, 0, maxH) * picW;
            int offP2 = clip(y + j, 0, maxH) * picW;
            int offP3 = clip(y + j + 1, 0, maxH) * picW;
            int offP4 = clip(y + j + 2, 0, maxH) * picW;
            int offP5 = clip(y + j + 3, 0, maxH) * picW;

            for (int i = 0; i < blkW; i++) {
                int pres_x = clip(x + i, 0, maxW);

                int a = pic[pres_x + offP0] + pic[pres_x + offP5];
                int b = pic[pres_x + offP1] + pic[pres_x + offP4];
                int c = pic[pres_x + offP2] + pic[pres_x + offP3];

                blk[blkOff + i] = a + 5 * ((c << 2) - b);
            }
            blkOff += blkStride;
        }
    }
static void getLuma02UnsafeNoRound(byte[] pic, int picW, int picH, int[] blk, int blkOff, int blkStride, int x,
            int y, int blkW, int blkH) {
        int maxH = picH - 1;
        int maxW = picW - 1;

        for (int j = 0; j < blkH; j++) {
            int offP0 = clip(y + j - 2, 0, maxH) * picW;
            int offP1 = clip(y + j - 1, 0, maxH) * picW;
            int offP2 = clip(y + j, 0, maxH) * picW;
            int offP3 = clip(y + j + 1, 0, maxH) * picW;
            int offP4 = clip(y + j + 2, 0, maxH) * picW;
            int offP5 = clip(y + j + 3, 0, maxH) * picW;

            for (int i = 0; i < blkW; i++) {
                int pres_x = clip(x + i, 0, maxW);

                int a = pic[pres_x + offP0] + pic[pres_x + offP5];
                int b = pic[pres_x + offP1] + pic[pres_x + offP4];
                int c = pic[pres_x + offP2] + pic[pres_x + offP3];

                blk[blkOff + i] = a + 5 * ((c << 2) - b);
            }
            blkOff += blkStride;
        }
    }
static void getLuma02UnsafeNoRound ( byte [ ] pic , int picW , int picH , int [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { int maxH = picH - 1 ; int maxW = picW - 1 ; for ( int j = 0 ; j < blkH ; j ++ ) { int offP0 = clip ( y + j - 2 , 0 , maxH ) * picW ; int offP1 = clip ( y + j - 1 , 0 , maxH ) * picW ; int offP2 = clip ( y + j , 0 , maxH ) * picW ; int offP3 = clip ( y + j + 1 , 0 , maxH ) * picW ; int offP4 = clip ( y + j + 2 , 0 , maxH ) * picW ; int offP5 = clip ( y + j + 3 , 0 , maxH ) * picW ; for ( int i = 0 ; i < blkW ; i ++ ) { int pres_x = clip ( x + i , 0 , maxW ) ; int a = pic [ pres_x + offP0 ] + pic [ pres_x + offP5 ] ; int b = pic [ pres_x + offP1 ] + pic [ pres_x + offP4 ] ; int c = pic [ pres_x + offP2 ] + pic [ pres_x + offP3 ] ; blk [ blkOff + i ] = a + 5 * ( ( c << 2 ) - b ) ; } blkOff += blkStride ; } }
Hpel (0, 2) vertical unsafe
Hpel ( 0 2 ) vertical unsafe