[FFmpeg-devel] [PATCH] dxva2_hevc: properly fill the scaling list structure
Hendrik Leppkes
h.leppkes at gmail.com
Tue Feb 3 22:33:44 CET 2015
On Tue, Feb 3, 2015 at 10:23 PM, Hendrik Leppkes <h.leppkes at gmail.com>
wrote:
> The HEVC decoder has the scaling lists in the SPS structs, and not the PPS.
> Additionally, it needs to compensate for the diagonal scan permutation
> applied in the decoder.
> ---
> libavcodec/dxva2_hevc.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
> index a9df5f4..7050c74 100644
> --- a/libavcodec/dxva2_hevc.c
> +++ b/libavcodec/dxva2_hevc.c
> @@ -192,23 +192,26 @@ 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;
> 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] = h->sps->scaling_list.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] = h->sps->scaling_list.sl
> [1][i][pos];
> + qm->ucScalingLists2[i][j] = h->sps->scaling_list.sl
> [2][i][pos];
>
> if (i < 2)
> - qm->ucScalingLists3[i][j] = h->pps->scaling_list.sl
> [3][i][j];
> + qm->ucScalingLists3[i][j] = h->sps->scaling_list.sl
> [3][i][pos];
> }
>
> - qm->ucScalingListDCCoefSizeID2[i] =
> h->pps->scaling_list.sl_dc[0][i];
> + qm->ucScalingListDCCoefSizeID2[i] =
> h->sps->scaling_list.sl_dc[0][i];
> if (i < 2)
> - qm->ucScalingListDCCoefSizeID3[i] =
> h->pps->scaling_list.sl_dc[1][i];
> + qm->ucScalingListDCCoefSizeID3[i] =
> h->sps->scaling_list.sl_dc[1][i];
> }
> }
>
> --
> 1.9.5.msysgit.0
>
>
Actually this is not entirely complete yet, apparently the ScalingList can
be defined in the SPS or the PPS, so I need to add a condition there.
More incoming soon.
- Hendrik
More information about the ffmpeg-devel
mailing list