[x265] [PATCH] Moved IntraFilterType from intrapred.cpp to predict.h to make it publicly available and replace Predict::filteringIntraReferenceSamples
dtyx265 at gmail.com
dtyx265 at gmail.com
Tue Aug 12 19:47:01 CEST 2014
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1407865529 25200
# Node ID 482a3a1625468af4b76c0a694763db20e3a4d37a
# Parent 8a7f4bb1d1be32fe668d410450c2e320ccae6098
Moved IntraFilterType from intrapred.cpp to predict.h to make it publicly available and replace Predict::filteringIntraReferenceSamples
diff -r 8a7f4bb1d1be -r 482a3a162546 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Tue Aug 12 01:11:39 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp Tue Aug 12 10:45:29 2014 -0700
@@ -68,7 +68,7 @@
fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
- bool bUseFilteredPredictions = (dirMode == ALL_IDX || Predict::filteringIntraReferenceSamples(dirMode, intraNeighbors.log2TrSize));
+ bool bUseFilteredPredictions = (dirMode == ALL_IDX || IntraFilterType[intraNeighbors.log2TrSize - 2][dirMode]);
if (bUseFilteredPredictions && 8 <= tuSize && tuSize <= 32)
{
diff -r 8a7f4bb1d1be -r 482a3a162546 source/common/intrapred.cpp
--- a/source/common/intrapred.cpp Tue Aug 12 01:11:39 2014 -0500
+++ b/source/common/intrapred.cpp Tue Aug 12 10:45:29 2014 -0700
@@ -25,18 +25,6 @@
#include "TLibCommon/TComRom.h"
#include "primitives.h"
-namespace x265 {
-unsigned char IntraFilterType[][35] =
-{
- // Index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34
- /* 4x4 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- /* 8x8 */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
- /* 16x16 */ { 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 },
- /* 32x32 */ { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
- /* 64x64 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-};
-}
-
using namespace x265;
namespace {
diff -r 8a7f4bb1d1be -r 482a3a162546 source/encoder/predict.cpp
--- a/source/encoder/predict.cpp Tue Aug 12 01:11:39 2014 -0500
+++ b/source/encoder/predict.cpp Tue Aug 12 10:45:29 2014 -0700
@@ -81,28 +81,10 @@
}
}
-bool Predict::filteringIntraReferenceSamples(uint32_t dirMode, uint32_t log2TrSize)
-{
- bool bFilter;
-
- if (dirMode == DC_IDX || log2TrSize <= 2)
- {
- bFilter = false; // no smoothing for DC
- }
- else
- {
- int diff = std::min<int>(abs((int)dirMode - HOR_IDX), abs((int)dirMode - VER_IDX));
- uint32_t sizeIdx = log2TrSize - 2;
- bFilter = diff > intraFilterThreshold[sizeIdx];
- }
-
- return bFilter;
-}
-
void Predict::predIntraLumaAng(uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSize)
{
int tuSize = 1 << log2TrSize;
- bool bUseFilteredPredictions = filteringIntraReferenceSamples(dirMode, log2TrSize);
+ bool bUseFilteredPredictions = IntraFilterType[log2TrSize - 2][dirMode];
pixel *refLft, *refAbv;
refLft = m_refLeft + tuSize - 1;
@@ -129,7 +111,7 @@
pixel refAbv[3 * MAX_CU_SIZE];
pixel refLft[3 * MAX_CU_SIZE];
- bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && filteringIntraReferenceSamples(dirMode, log2TrSizeC));
+ bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && IntraFilterType[log2TrSizeC - 2][dirMode]);
if (bUseFilteredPredictions)
{
diff -r 8a7f4bb1d1be -r 482a3a162546 source/encoder/predict.h
--- a/source/encoder/predict.h Tue Aug 12 01:11:39 2014 -0500
+++ b/source/encoder/predict.h Tue Aug 12 10:45:29 2014 -0700
@@ -34,6 +34,16 @@
#include "TLibCommon/TComWeightPrediction.h"
namespace x265 {
+/* This table requires IntraFilterType[log2Size - 2][intra mode] */
+static const unsigned char IntraFilterType[5][35] =
+{
+ // Index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34
+ /* 4x4 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* 8x8 */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
+ /* 16x16 */ { 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 },
+ /* 32x32 */ { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
+ /* 64x64 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+};
class Predict : public TComWeightPrediction
{
@@ -93,7 +103,6 @@
// Angular Intra
void predIntraLumaAng(uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSize);
void predIntraChromaAng(pixel* src, uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSizeC, int chFmt);
- static bool filteringIntraReferenceSamples(uint32_t dirMode, uint32_t log2TrSize);
};
}
More information about the x265-devel
mailing list