[x265] replace IntraFilterType[][] to IntraFilterFlags[] (aboid *35)

Steve Borho steve at borho.org
Thu Aug 14 20:13:03 CEST 2014


On 08/14, Satoshi Nakagawa wrote:
> # HG changeset patch
> # User Satoshi Nakagawa <nakagawa424 at oki.com>
> # Date 1407984148 -32400
> #      Thu Aug 14 11:42:28 2014 +0900
> # Node ID a369fcc9c0e43812feb285004c09bf9ea9706456
> # Parent  d66e257ace3210d828a399e05eeba1b05abb21af
> replace IntraFilterType[][] to IntraFilterFlags[] (aboid *35)

thanks, queued after rebasing to current tip and changing
intraFilterFlags to g_intraFilterFlags

> diff -r d66e257ace32 -r a369fcc9c0e4 source/Lib/TLibCommon/TComPattern.cpp
> --- a/source/Lib/TLibCommon/TComPattern.cpp	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/Lib/TLibCommon/TComPattern.cpp	Thu Aug 14 11:42:28 2014 +0900
> @@ -38,7 +38,7 @@
>  #include "frame.h"
>  #include "TComPattern.h"
>  #include "TComDataCU.h"
> -#include "predict.h"
> +#include "TComRom.h"
>  
>  using namespace x265;
>  
> @@ -68,7 +68,7 @@
>  
>      fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
>  
> -    bool bUseFilteredPredictions = (dirMode == ALL_IDX || IntraFilterType[intraNeighbors.log2TrSize - 2][dirMode]);
> +    bool bUseFilteredPredictions = (dirMode == ALL_IDX || (intraFilterFlags[dirMode] & tuSize));
>  
>      if (bUseFilteredPredictions && 8 <= tuSize && tuSize <= 32)
>      {
> diff -r d66e257ace32 -r a369fcc9c0e4 source/Lib/TLibCommon/TComRom.cpp
> --- a/source/Lib/TLibCommon/TComRom.cpp	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/Lib/TLibCommon/TComRom.cpp	Thu Aug 14 11:42:28 2014 +0900
> @@ -491,5 +491,15 @@
>      106,  110,  114,  118,  122,  126,  130,  135,  139,  143,  147,  152,  156,  161,  165,  170,
>      175,  179,  184,  189,  194,  198,  203,  208,  214,  219,  224,  229,  234,  240,  245,  250
>  };
> +
> +/* intraFilterFlags[dir] & trSize */
> +const uint8_t intraFilterFlags[35] =
> +{
> +    0x38, 0x00,
> +    0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x00, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
> +    0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x00, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
> +    0x38, 
> +};
> +
>  }
>  //! \}
> diff -r d66e257ace32 -r a369fcc9c0e4 source/Lib/TLibCommon/TComRom.h
> --- a/source/Lib/TLibCommon/TComRom.h	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/Lib/TLibCommon/TComRom.h	Thu Aug 14 11:42:28 2014 +0900
> @@ -148,6 +148,9 @@
>  extern const uint8_t g_lpsTable[64][4];
>  extern const uint8_t x265_exp2_lut[64];
>  
> +// Intra tables
> +extern const uint8_t intraFilterFlags[35];
> +
>  }
>  
>  #endif  //ifndef X265_TCOMROM_H
> diff -r d66e257ace32 -r a369fcc9c0e4 source/common/intrapred.cpp
> --- a/source/common/intrapred.cpp	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/common/intrapred.cpp	Thu Aug 14 11:42:28 2014 +0900
> @@ -21,7 +21,6 @@
>   * For more information, contact us at license @ x265.com.
>   *****************************************************************************/
>  
> -#include "predict.h"
>  #include "TLibCommon/TComRom.h"
>  #include "primitives.h"
>  
> @@ -249,11 +248,10 @@
>  void all_angs_pred_c(pixel *dest, pixel *above0, pixel *left0, pixel *above1, pixel *left1, int bLuma)
>  {
>      const int size = 1 << log2Size;
> -    const int sizeIdx = log2Size - 2;
>      for (int mode = 2; mode <= 34; mode++)
>      {
> -        pixel *left = (IntraFilterType[sizeIdx][mode] ? left1 : left0);
> -        pixel *above = (IntraFilterType[sizeIdx][mode] ? above1 : above0);
> +        pixel *left  = (intraFilterFlags[mode] & size ? left1  : left0);
> +        pixel *above = (intraFilterFlags[mode] & size ? above1 : above0);
>          pixel *out = dest + ((mode - 2) << (log2Size * 2));
>  
>          intra_pred_ang_c<size>(out, size, left, above, mode, bLuma);
> diff -r d66e257ace32 -r a369fcc9c0e4 source/common/x86/asm-primitives.cpp
> --- a/source/common/x86/asm-primitives.cpp	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/common/x86/asm-primitives.cpp	Thu Aug 14 11:42:28 2014 +0900
> @@ -27,7 +27,7 @@
>  #include "x265.h"
>  #include "cpu.h"
>  #if HIGH_BIT_DEPTH
> -#include "predict.h"
> +#include "TLibCommon/TComRom.h"
>  #endif
>  
>  extern "C" {
> @@ -525,7 +525,7 @@
>      SETUP_CHROMA_SS_FUNC_DEF_444(64, 48, cpu); \
>      SETUP_CHROMA_SS_FUNC_DEF_444(48, 64, cpu); \
>      SETUP_CHROMA_SS_FUNC_DEF_444(64, 16, cpu); \
> -    SETUP_CHROMA_SS_FUNC_DEF_444(16, 64, cpu)
> +    SETUP_CHROMA_SS_FUNC_DEF_444(16, 64, cpu);
>  
>  #if HIGH_BIT_DEPTH    // temporary, until all 10bit functions are completed
>  #define SETUP_LUMA_FUNC_DEF(W, H, cpu) \
> @@ -1139,7 +1139,7 @@
>      SETUP_CHROMA_VERT_FUNC_DEF_444(64, 48, cpu); \
>      SETUP_CHROMA_VERT_FUNC_DEF_444(48, 64, cpu); \
>      SETUP_CHROMA_VERT_FUNC_DEF_444(64, 16, cpu); \
> -    SETUP_CHROMA_VERT_FUNC_DEF_444(16, 64, cpu)
> +    SETUP_CHROMA_VERT_FUNC_DEF_444(16, 64, cpu);
>  
>  #define SETUP_CHROMA_HORIZ_FUNC_DEF(W, H, cpu) \
>      p.chroma[X265_CSP_I420].filter_hpp[CHROMA_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
> @@ -1169,7 +1169,7 @@
>      SETUP_CHROMA_HORIZ_FUNC_DEF(32, 24, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF(24, 32, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF(32, 8, cpu); \
> -    SETUP_CHROMA_HORIZ_FUNC_DEF(8, 32, cpu)
> +    SETUP_CHROMA_HORIZ_FUNC_DEF(8, 32, cpu);
>  
>  #define SETUP_CHROMA_HORIZ_FUNC_DEF_422(W, H, cpu) \
>      p.chroma[X265_CSP_I422].filter_hpp[CHROMA422_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
> @@ -1199,7 +1199,7 @@
>      SETUP_CHROMA_HORIZ_FUNC_DEF_422(32, 48, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF_422(24, 64, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF_422(32, 16, cpu); \
> -    SETUP_CHROMA_HORIZ_FUNC_DEF_422(8, 64, cpu)
> +    SETUP_CHROMA_HORIZ_FUNC_DEF_422(8, 64, cpu);
>  
>  #define SETUP_CHROMA_HORIZ_FUNC_DEF_444(W, H, cpu) \
>      p.chroma[X265_CSP_I444].filter_hpp[LUMA_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
> @@ -1229,7 +1229,7 @@
>      SETUP_CHROMA_HORIZ_FUNC_DEF_444(64, 48, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF_444(48, 64, cpu); \
>      SETUP_CHROMA_HORIZ_FUNC_DEF_444(64, 16, cpu); \
> -    SETUP_CHROMA_HORIZ_FUNC_DEF_444(16, 64, cpu)
> +    SETUP_CHROMA_HORIZ_FUNC_DEF_444(16, 64, cpu);
>  
>  namespace x265 {
>  // private x265 namespace
> @@ -1245,8 +1245,8 @@
>  
>      for (int mode = 2; mode <= 34; mode++)
>      {
> -        pixel *left = (IntraFilterType[sizeIdx][mode] ? left1 : left0);
> -        pixel *above = (IntraFilterType[sizeIdx][mode] ? above1 : above0);
> +        pixel *left  = (intraFilterFlags[mode] & size ? left1  : left0);
> +        pixel *above = (intraFilterFlags[mode] & size ? above1 : above0);
>          pixel *out = dest + ((mode - 2) << (log2Size * 2));
>  
>          if (mode < 18)
> diff -r d66e257ace32 -r a369fcc9c0e4 source/common/x86/pixel-util.h
> --- a/source/common/x86/pixel-util.h	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/common/x86/pixel-util.h	Thu Aug 14 11:42:28 2014 +0900
> @@ -71,7 +71,7 @@
>  #define CHROMA_PIXELSUB_DEF(cpu) \
>      SETUP_CHROMA_PIXELSUB_PS_FUNC(4, 4, cpu); \
>      SETUP_CHROMA_PIXELSUB_PS_FUNC(8, 8, cpu); \
> -    SETUP_CHROMA_PIXELSUB_PS_FUNC(16, 16, cpu);
> +    SETUP_CHROMA_PIXELSUB_PS_FUNC(16, 16, cpu); \
>      SETUP_CHROMA_PIXELSUB_PS_FUNC(32, 32, cpu);
>  
>  #define CHROMA_PIXELSUB_DEF_422(cpu) \
> diff -r d66e257ace32 -r a369fcc9c0e4 source/encoder/predict.cpp
> --- a/source/encoder/predict.cpp	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/encoder/predict.cpp	Thu Aug 14 11:42:28 2014 +0900
> @@ -77,10 +77,13 @@
>      int tuSize = 1 << log2TrSize;
>  
>      pixel *refLft, *refAbv;
> -    refLft = m_refLeft + tuSize - 1;
> -    refAbv = m_refAbove + tuSize - 1;
>  
> -    if (IntraFilterType[log2TrSize - 2][dirMode])
> +    if (!(intraFilterFlags[dirMode] & tuSize))
> +    {
> +        refLft = m_refLeft + tuSize - 1;
> +        refAbv = m_refAbove + tuSize - 1;
> +    }
> +    else
>      {
>          refLft = m_refLeftFlt + tuSize - 1;
>          refAbv = m_refAboveFlt + tuSize - 1;
> @@ -101,7 +104,7 @@
>      pixel refAbv[3 * MAX_CU_SIZE];
>      pixel refLft[3 * MAX_CU_SIZE];
>  
> -    bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && IntraFilterType[log2TrSizeC - 2][dirMode]);
> +    bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && (intraFilterFlags[dirMode] & tuSize));
>  
>      if (bUseFilteredPredictions)
>      {
> diff -r d66e257ace32 -r a369fcc9c0e4 source/encoder/predict.h
> --- a/source/encoder/predict.h	Wed Aug 13 17:29:18 2014 -0700
> +++ b/source/encoder/predict.h	Thu Aug 14 11:42:28 2014 +0900
> @@ -34,16 +34,6 @@
>  #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
>  {
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list