]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dxva2_hevc.c
avcodec/dxtory: use init_get_bits8()
[ffmpeg] / libavcodec / dxva2_hevc.c
index 2de9ef2c5c62a2af1764883806d8c7ad04532286..4fba3ad64839612c90d6766f79c9b8b88495ea05 100644 (file)
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2014 - 2015 Hendrik Leppkes
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -192,23 +192,29 @@ static void fill_picture_parameters(struct dxva_context *ctx, const HEVCContext
 
 static void fill_scaling_lists(struct dxva_context *ctx, const HEVCContext *h, DXVA_Qmatrix_HEVC *qm)
 {
-    unsigned i, j;
+    unsigned i, j, pos;
+    const ScalingList *sl = h->pps->scaling_list_data_present_flag ?
+                            &h->pps->scaling_list : &h->sps->scaling_list;
+
     memset(qm, 0, sizeof(*qm));
     for (i = 0; i < 6; i++) {
-        for (j = 0; j < 16; j++)
-            qm->ucScalingLists0[i][j] = h->pps->scaling_list.sl[0][i][j];
+        for (j = 0; j < 16; j++) {
+            pos = 4 * ff_hevc_diag_scan4x4_y[j] + ff_hevc_diag_scan4x4_x[j];
+            qm->ucScalingLists0[i][j] = sl->sl[0][i][pos];
+        }
 
         for (j = 0; j < 64; j++) {
-            qm->ucScalingLists1[i][j] = h->pps->scaling_list.sl[1][i][j];
-            qm->ucScalingLists2[i][j] = h->pps->scaling_list.sl[2][i][j];
+            pos = 8 * ff_hevc_diag_scan8x8_y[j] + ff_hevc_diag_scan8x8_x[j];
+            qm->ucScalingLists1[i][j] = sl->sl[1][i][pos];
+            qm->ucScalingLists2[i][j] = sl->sl[2][i][pos];
 
             if (i < 2)
-                qm->ucScalingLists3[i][j] = h->pps->scaling_list.sl[3][i][j];
+                qm->ucScalingLists3[i][j] = sl->sl[3][i][pos];
         }
 
-        qm->ucScalingListDCCoefSizeID2[i] = h->pps->scaling_list.sl_dc[0][i];
+        qm->ucScalingListDCCoefSizeID2[i] = sl->sl_dc[0][i];
         if (i < 2)
-            qm->ucScalingListDCCoefSizeID3[i] = h->pps->scaling_list.sl_dc[1][i];
+            qm->ucScalingListDCCoefSizeID3[i] = sl->sl_dc[1][i];
     }
 }