radeon/uvd: update quantiser matrices only when requested
authorIndrajit Das <indrajit-kumar.das@amd.com>
Wed, 10 Jan 2018 09:40:17 +0000 (15:10 +0530)
committerChristian König <christian.koenig@amd.com>
Tue, 16 Jan 2018 09:50:08 +0000 (10:50 +0100)
Only upload them when the pointers are valid.

Signed-off-by: Indrajit Das <indrajit-kumar.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeon/radeon_uvd.c

index b46ee6e3c4045772508f532e4b2f16eabace011c..78ced179bb4c9e6cb84d6e553de8503569e3ea3b 100644 (file)
@@ -871,12 +871,17 @@ static struct ruvd_mpeg2 get_mpeg2_msg(struct ruvd_decoder *dec,
        for (i = 0; i < 2; ++i)
                result.ref_pic_idx[i] = get_ref_pic_idx(dec, pic->ref[i]);
 
-       result.load_intra_quantiser_matrix = 1;
-       result.load_nonintra_quantiser_matrix = 1;
-
-       for (i = 0; i < 64; ++i) {
-               result.intra_quantiser_matrix[i] = pic->intra_matrix[zscan[i]];
-               result.nonintra_quantiser_matrix[i] = pic->non_intra_matrix[zscan[i]];
+       if(pic->intra_matrix) {
+               result.load_intra_quantiser_matrix = 1;
+               for (i = 0; i < 64; ++i) {
+                       result.intra_quantiser_matrix[i] = pic->intra_matrix[zscan[i]];
+               }
+       }
+       if(pic->non_intra_matrix) {
+               result.load_nonintra_quantiser_matrix = 1;
+               for (i = 0; i < 64; ++i) {
+                       result.nonintra_quantiser_matrix[i] = pic->non_intra_matrix[zscan[i]];
+               }
        }
 
        result.profile_and_level_indication = 0;