radeon/vcn: update quantiser matrices only when requested
authorIndrajit Das <indrajit-kumar.das@amd.com>
Wed, 10 Jan 2018 09:42:44 +0000 (15:12 +0530)
committerChristian König <christian.koenig@amd.com>
Tue, 16 Jan 2018 09:51:00 +0000 (10:51 +0100)
Only update 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_vcn_dec.c

index 8be95382cc06caf32d093c70e6d72c3ad7a120de..d51eb6e3949b34c34fe302a2332b4aded0b726e4 100644 (file)
@@ -498,12 +498,17 @@ static rvcn_dec_message_mpeg2_vld_t get_mpeg2_msg(struct radeon_decoder *dec,
        result.forward_ref_pic_idx = get_ref_pic_idx(dec, pic->ref[0]);
        result.backward_ref_pic_idx = get_ref_pic_idx(dec, pic->ref[1]);
 
-       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;