[x265] [PATCH] fix bug in scaling list

Ashok Kumar Mishra ashok at multicorewareinc.com
Fri Mar 18 14:38:45 CET 2016


On Fri, Mar 18, 2016 at 5:46 PM, <vignesh at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Vignesh <vignesh at multicorewareinc.com>
> # Date 1458043301 -19800
> #      Tue Mar 15 17:31:41 2016 +0530
> # Node ID f38191b0a7ddc6b29c79fecc2821e11e8b24e1db
> # Parent  4a2f94a592511afabd434fc6cf02a469b6d65091
> fix bug in scaling list
>
> diff -r 4a2f94a59251 -r f38191b0a7dd source/common/scalinglist.cpp
> --- a/source/common/scalinglist.cpp     Wed Mar 09 14:34:06 2016 +0530
> +++ b/source/common/scalinglist.cpp     Tue Mar 15 17:31:41 2016 +0530
> @@ -57,7 +57,11 @@
>      },
>      {
>          "INTRA32X32_LUMA",
> +        "",
> +        "",
>          "INTER32X32_LUMA",
> +        "",
> +        "",
>      },
>  };
>  const char MatrixType_DC[4][12][22] =
> @@ -76,7 +80,11 @@
>      },
>      {
>          "INTRA32X32_LUMA_DC",
> +        "",
> +        "",
>          "INTER32X32_LUMA_DC",
> +        "",
> +        "",
>      },
>  };
>
> @@ -246,15 +254,15 @@
>
>      char line[1024];
>      int32_t *src = NULL;
> +    fseek(fp, 0, 0);
>
>      for (int sizeIdc = 0; sizeIdc < NUM_SIZES; sizeIdc++)
>      {
>          int size = X265_MIN(MAX_MATRIX_COEF_NUM,
> s_numCoefPerSize[sizeIdc]);
> -        for (int listIdc = 0; listIdc < NUM_LISTS; listIdc++)
> +        for (int listIdc = 0; listIdc < NUM_LISTS;  listIdc += (sizeIdc
> == 3) ? 3 : 1)
>
instead of writing  listIdc += (sizeIdc == 3) ? 3 : 1, you can write
listIdc += sizeIdc & 3.
so that if condition check can be avoided.

>          {
>              src = m_scalingListCoef[sizeIdc][listIdc];
>
> -            fseek(fp, 0, 0);
>              do
>              {
>                  char *ret = fgets(line, 1024, fp);
> @@ -282,7 +290,6 @@
>
>              if (sizeIdc > BLOCK_8x8)
>              {
> -                fseek(fp, 0, 0);
>                  do
>                  {
>                      char *ret = fgets(line, 1024, fp);
> @@ -310,7 +317,7 @@
>      fclose(fp);
>
>      m_bEnabled = true;
> -    m_bDataPresent = !checkDefaultScalingList();
> +    m_bDataPresent = true;
>
>      return false;
>  }
> diff -r 4a2f94a59251 -r f38191b0a7dd source/encoder/entropy.cpp
> --- a/source/encoder/entropy.cpp        Wed Mar 09 14:34:06 2016 +0530
> +++ b/source/encoder/entropy.cpp        Tue Mar 15 17:31:41 2016 +0530
> @@ -306,7 +306,7 @@
>  {
>      for (int sizeId = 0; sizeId < ScalingList::NUM_SIZES; sizeId++)
>      {
> -        for (int listId = 0; listId < ScalingList::NUM_LISTS; listId++)
> +        for (int listId = 0; listId < ScalingList::NUM_LISTS; listId +=
> (sizeId == 3) ? 3 : 1)
>
Check above comment

>          {
>              int predList = scalingList.checkPredMode(sizeId, listId);
>              WRITE_FLAG(predList < 0, "scaling_list_pred_mode_flag");
> @@ -334,12 +334,7 @@
>      for (int i = 0; i < coefNum; i++)
>      {
>          data = src[scan[i]] - nextCoef;
> -        nextCoef = src[scan[i]];
> -        if (data > 127)
> -            data = data - 256;
> -        if (data < -128)
> -            data = data + 256;
> -
> +        nextCoef = (nextCoef + data + 256) % 256;
>          WRITE_SVLC(data,  "scaling_list_delta_coef");
>      }
>  }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160318/93459b1d/attachment-0001.html>


More information about the x265-devel mailing list