[x265] [PATCH] modified the QP lambda table(x265_lambda2_tab[]) for CQP

Steve Borho steve at borho.org
Tue Sep 3 20:49:03 CEST 2013


On Tue, Sep 3, 2013 at 6:30 AM, <sumalatha at multicorewareinc.com> wrote:

> # HG changeset patch
> # User sumalatha
> # Date 1378207798 -19800
> # Node ID 0151d371a9efc3af17d23ae8269504b939ceac2c
> # Parent  2f9fcf7689181107c11ec400047edef1e714cb67
> modified the QP lambda table(x265_lambda2_tab[]) for CQP
>
> diff -r 2f9fcf768918 -r 0151d371a9ef source/Lib/TLibCommon/TComRom.cpp
> --- a/source/Lib/TLibCommon/TComRom.cpp Mon Sep 02 16:16:04 2013 +0530
> +++ b/source/Lib/TLibCommon/TComRom.cpp Tue Sep 03 16:59:58 2013 +0530
> @@ -514,13 +514,27 @@
>  const Int g_winUnitX[] = { 1, 2, 2, 1 };
>  const Int g_winUnitY[] = { 1, 2, 1, 1 };
>
> +//for all_I config
> +const int x265_lambda2_tab_all_I[MAX_QP + 1] =
> +{
> +0.022265625, 0.028052813, 0.035344375, 0.04453125, 0.056105938,
> 0.070689063, 0.0890625,
> +0.112211563, 0.141377813, 0.178125, 0.224423438, 0.282755938, 0.35625,
> 0.448846875,
> +0.565511563, 0.7125, 0.89769375, 1.131023125, 1.425, 1.7953875,
> 2.262046563, 2.85,
> +3.590775, 4.524093125, 5.7, 7.7800125, 10.55621688, 14.25, 19.1508,
> 25.63652688, 34.2,
> +45.48315, 60.32124, 79.8, 105.3293997, 138.7388519, 182.4, 229.8095994,
> 289.5419519, 364.8,
> +459.6191991, 579.0839038, 729.6, 919.2383981, 1158.167808, 1459.2,
> 1838.476796, 2316.335615,
> +2918.4, 3676.953592, 4632.67123 };
>

both of these are "const int" tables, so initializing them with doubles is
not too helpful.

I think that until we have settled on the values in these tables, it would
be better to generate them programatically within initROM().  this would
implicitly document the formula used to generate these values.

Lastly, I suspect we need to use X265_MIN(1, val) to prevent 0 values in
these tables.

+
> +//for keyINt>1 , bframes- disable
>  const int x265_lambda2_tab[MAX_QP + 1] =
> -{ 14,  18,   23,   30,   39,   50,   64,   83,
> -  106,  137,  176,  226,  291,  374,  480,  617,
> -  794,  1020, 1311, 1686, 2165, 2783, 3576, 4594,
> -  5904, 7586, 9747, 12524,  16094,  20679,  26571,  34143,
> -  43871,  56371,  72432,  93070,  119587, 153661, 197441, 253697,
> -  325982, 418861, 538203, 691549, 888585, 1141764, 1467077, 1885077,
> -  2422177, 3112305 };
> + {
> +0.0333091, 0.0419672, 0.0528748, 0.0666182, 0.0839344, 0.1057507,
> 0.1332375, 0.1678688, 0.2115014,
> +0.266475, 0.3357376, 0.4230028, 0.53295, 0.6714752, 0.8460056, 1.0659,
> 1.3429493, 1.6920112, 2.1318,
> +2.6858997, 3.3840213, 4.2636, 5.3717994, 6.7680426, 8.5272, 10.7435988,
> 13.5360863, 17.0544,
> +21.4871976, 27.0721726, 34.1088, 42.9743952, 54.1443452,  68.2176,
> 85.9487904, 108.2886904, 136.4352,
> +171.8975808, 216.5773797, 272.8704, 343.7951605, 433.1547605, 545.7408,
> 687.5903221, 866.3095199,
> +1091.4816, 1375.180643, 1732.61904, 2182.9632, 2750.361287, 3465.23808,
> 4365.9264
> +};
>
>  //! \}
> diff -r 2f9fcf768918 -r 0151d371a9ef source/Lib/TLibCommon/TComRom.h
> --- a/source/Lib/TLibCommon/TComRom.h   Mon Sep 02 16:16:04 2013 +0530
> +++ b/source/Lib/TLibCommon/TComRom.h   Tue Sep 03 16:59:58 2013 +0530
> @@ -291,4 +291,5 @@
>  extern const Int g_winUnitX[MAX_CHROMA_FORMAT_IDC + 1];
>  extern const Int g_winUnitY[MAX_CHROMA_FORMAT_IDC + 1];
>  extern const int x265_lambda2_tab[MAX_QP+1];
> +extern const int x265_lambda2_tab_all_I[MAX_QP + 1];
>  #endif  //__TCOMROM__
> diff -r 2f9fcf768918 -r 0151d371a9ef source/Lib/TLibEncoder/TEncTop.cpp
> --- a/source/Lib/TLibEncoder/TEncTop.cpp        Mon Sep 02 16:16:04 2013
> +0530
> +++ b/source/Lib/TLibEncoder/TEncTop.cpp        Tue Sep 03 16:59:58 2013
> +0530
> @@ -844,7 +844,22 @@
>  {
>      FrameEncoder *curEncoder = &m_frameEncoder[m_curEncoder];
>      Int qp = slice->getSliceQp();
> -    Int lambda = x265_lambda2_tab[qp] >> 8;
> +    Int lambda = 0;
> +       if(param.keyframeMax == 1)
>

tabs, white-space


> +    {
> +        lambda = x265_lambda2_tab_all_I[qp];
> +    }
> +    else
> +    {
> +        if(slice->getSliceType() == I_SLICE)
> +            {
> +                lambda =x265_lambda2_tab[qp] ;
> +        }
> +        else
> +        {
> +            lambda = x265_lambda2_tab[qp] *1.9;
> +        }
> +    }
>
>      // for RDO
>      // in RdCost there is only one lambda because the luma and chroma
> bits are not separated,
> diff -r 2f9fcf768918 -r 0151d371a9ef source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Mon Sep 02 16:16:04 2013 +0530
> +++ b/source/encoder/frameencoder.cpp   Tue Sep 03 16:59:58 2013 +0530
> @@ -325,6 +325,24 @@
>          lambda *= m_cfg->getLambdaModifier(0); // temporal layer 0
>      }
>
> +#if 0//to be reviewed
> +    if(m_cfg->param.keyframeMax == 1)
> +    {
> +        lambda = x265_lambda2_tab_all_I[qp];
> +    }
> +    else
> +    {
> +        if(slice->getSliceType() == I_SLICE)
> +            {
> +                lambda =x265_lambda2_tab[qp] ;
> +        }
> +        else
> +        {
> +            lambda = x265_lambda2_tab[qp] *1.9;
> +        }
> +    }
> +#endif
> +
>      // for RDO
>      // in RdCost there is only one lambda because the luma and chroma
> bits are not separated,
>      // instead we weight the distortion of chroma.
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.videolan.org/private/x265-devel/attachments/20130903/aa4852c4/attachment-0001.html>


More information about the x265-devel mailing list