[x265] [PATCH] C primitive for weighted ipfilter
deepthidevaki at multicorewareinc.com
deepthidevaki at multicorewareinc.com
Wed Jul 17 13:05:26 CEST 2013
# HG changeset patch
# User Deepthi Devaki
# Date 1374058942 -19800
# Node ID 484be0ed2f71d2f4fa2363d55f4a5bbd31c656f7
# Parent 054d8c409569100c4aacb015ffb1b3281100d993
C primitive for weighted ipfilter
diff -r 054d8c409569 -r 484be0ed2f71 source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp Wed Jul 17 11:33:20 2013 +0530
+++ b/source/common/ipfilter.cpp Wed Jul 17 16:32:22 2013 +0530
@@ -491,6 +491,71 @@
extendPicCompBorder(pDstB, pDstStride, block_width, block_height, marginX, marginY);
extendPicCompBorder(pDstC, pDstStride, block_width, block_height, marginX, marginY);
}
+
+void weightUnidir(int bitDepth, short *src, pixel *dst, int srcStride, int dstStride, int width, int height, int w0, int round, int shift, int offset)
+{
+ int x, y;
+ for (y = height - 1; y >= 0; y--)
+ {
+ for (x = width - 1; x >= 0; )
+ {
+ // note: luma min width is 4
+ dst[x] = (pixel) Clip3(0, ((1 << bitDepth) - 1), ((w0 * (src[x] + IF_INTERNAL_OFFS) + round) >> shift) + offset);
+ x--;
+ dst[x] = (pixel) Clip3(0, ((1 << bitDepth) - 1), ((w0 * (src[x] + IF_INTERNAL_OFFS) + round) >> shift) + offset);
+ x--;
+ }
+
+ src += srcStride;
+ dst += dstStride;
+ }
+}
+
+// filterHorizontal, Multiplane, Weighted
+void filterHorizontalWeighted(int bitDepth, pixel *src, int srcStride, short *midF, short* midA, short* midB, short* midC, int midStride, pixel *pDstA, pixel *pDstB, pixel *pDstC, int pDstStride, int block_width, int block_height, int marginX, int marginY, int w, int roundw, int shiftw, int offsetw)
+{
+ filterConvertPelToShort(bitDepth, src, srcStride, midF, midStride, block_width, block_height);
+ filterHorizontal_p_s<8>(bitDepth, src, srcStride, midB, midStride, block_width, block_height, g_lumaFilter[2]);
+ filterHorizontal_p_s<8>(bitDepth, src, srcStride, midA, midStride, block_width, block_height, g_lumaFilter[1]);
+ filterHorizontal_p_s<8>(bitDepth, src, srcStride, midC, midStride, block_width, block_height, g_lumaFilter[3]);
+
+ weightUnidir(bitDepth, midA,pDstA,midStride,pDstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+ weightUnidir(bitDepth, midB,pDstB,midStride,pDstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+ weightUnidir(bitDepth, midC,pDstC,midStride,pDstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+
+ extendPicCompBorder(pDstA, pDstStride, block_width, block_height, marginX, marginY);
+ extendPicCompBorder(pDstB, pDstStride, block_width, block_height, marginX, marginY);
+ extendPicCompBorder(pDstC, pDstStride, block_width, block_height, marginX, marginY);
+}
+
+// filterVertical, Multiplane, Weighted
+void filterVerticalWeighted(int bitDepth, short *src, int srcStride, pixel *dstE, pixel *dstI, pixel *dstP, int dstStride, int block_width, int block_height, int marginX, int marginY, int w, int roundw, int shiftw, int offsetw)
+{
+ short* intI, *intE, *intP;
+ int intStride = block_width;
+
+ intI = (short*)xMalloc(short, block_height * block_width);
+ intE = (short*)xMalloc(short, block_height * block_width);
+ intP = (short*)xMalloc(short, block_height * block_width);
+
+ filterVertical_s_s<8>(bitDepth, src, srcStride, intI, intStride, block_width, block_height, g_lumaFilter[2]);
+ filterVertical_s_s<8>(bitDepth, src, srcStride, intE, intStride, block_width, block_height, g_lumaFilter[1]);
+ filterVertical_s_s<8>(bitDepth, src, srcStride, intP, intStride, block_width, block_height, g_lumaFilter[3]);
+
+ weightUnidir(bitDepth, intI, dstI, intStride, dstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+ weightUnidir(bitDepth, intE, dstE, intStride, dstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+ weightUnidir(bitDepth, intP, dstP, intStride, dstStride,block_width, block_height, w, roundw, shiftw, offsetw);
+
+ extendPicCompBorder(dstE, dstStride, block_width, block_height, marginX, marginY);
+ extendPicCompBorder(dstI, dstStride, block_width, block_height, marginX, marginY);
+ extendPicCompBorder(dstP, dstStride, block_width, block_height, marginX, marginY);
+
+ xFree(intI);
+ xFree(intE);
+ xFree(intP);
+
+}
+
}
#if _MSC_VER
@@ -521,5 +586,8 @@
p.filterVmulti = filterVerticalMultiplaneExtend;
p.filterHmulti = filterHorizontalMultiplaneExtend;
+
+ p.filterVwghtd = filterVerticalWeighted;
+ p.filterHwghtd = filterHorizontalWeighted;
}
}
diff -r 054d8c409569 -r 484be0ed2f71 source/common/primitives.h
--- a/source/common/primitives.h Wed Jul 17 11:33:20 2013 +0530
+++ b/source/common/primitives.h Wed Jul 17 16:32:22 2013 +0530
@@ -210,8 +210,11 @@
typedef void (*transpose_t)(pixel* dst, pixel* src, intptr_t stride);
typedef void (*filterVmulti_t)(int bitDepth, short *src, int srcStride, pixel *dstE, pixel *dstI, pixel *dstP, int dstStride,
int block_width, int block_height, int marginX, int marginY);
+typedef void (*filterVwghtd_t)(int bitDepth, short *src, int srcStride, pixel *dstE, pixel *dstI, pixel *dstP, int dstStride, int block_width, int block_height, int marginX, int marginY, int w, int roundw, int shiftw, int offsetw);
typedef void (*filterHmulti_t)(int bitDepth, pixel *src, int srcStride, short *midF, short* midA, short* midB, short* midC, int midStride,
pixel *dstA, pixel *dstB, pixel *dstC, int dstStride, int block_width, int block_height, int marginX, int marginY);
+typedef void (*filterHwghtd_t)(int bitDepth, pixel *src, int srcStride, short *midF, short* midA, short* midB, short* midC, int midStride, pixel *pDstA, pixel *pDstB, pixel *pDstC, int pDstStride, int block_width, int block_height,
+ int marginX, int marginY, int w, int roundw, int shiftw, int offsetw);
typedef void (*dequant_t)(int bitDepth, const int* src, int* dst, int width, int height, int mcqp_miper, int mcqp_mirem, bool useScalingList, unsigned int trSizeLog2, int *dequantCoef);
typedef uint32_t (*quant_t)(int *coef, int *quantCoeff, int *deltaU, int *qCoef, int qBits, int add, int numCoeff);
typedef void (*weightpUni_t)(short *src, pixel *dst, int srcStride, int dstStride, int width, int height, int w0, int round, int shift, int offset, int bitDepth);
@@ -267,6 +270,9 @@
weightpUni_t weightpUni;
pixelsub_sp_t pixelsubsp;
+
+ filterVwghtd_t filterVwghtd;
+ filterHwghtd_t filterHwghtd;
};
/* This copy of the table is what gets used by the encoder.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhevc_deepthid.patch
Type: text/x-patch
Size: 6592 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130717/d7a7a077/attachment.bin>
More information about the x265-devel
mailing list