r600g/sb: fix incorrect assert
[mesa.git] / src / gallium / drivers / radeon / radeon_uvd.c
index 9d0e0a27386dbdf9fdd820b8da3bbed5832bcf0b..caf3e9041d60428284570be0874af6ec035837df 100644 (file)
@@ -514,6 +514,7 @@ static uint32_t get_ref_pic_idx(struct ruvd_decoder *dec, struct pipe_video_buff
 static struct ruvd_mpeg2 get_mpeg2_msg(struct ruvd_decoder *dec,
                                       struct pipe_mpeg12_picture_desc *pic)
 {
+       const int *zscan = pic->alternate_scan ? vl_zscan_alternate : vl_zscan_normal;
        struct ruvd_mpeg2 result;
        unsigned i;
 
@@ -524,8 +525,11 @@ static struct ruvd_mpeg2 get_mpeg2_msg(struct ruvd_decoder *dec,
 
        result.load_intra_quantiser_matrix = 1;
        result.load_nonintra_quantiser_matrix = 1;
-       memcpy(&result.intra_quantiser_matrix, pic->intra_matrix, 64);
-       memcpy(&result.nonintra_quantiser_matrix, pic->non_intra_matrix, 64);
+
+       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]];
+       }
 
        result.profile_and_level_indication = 0;
        result.chroma_format = 0x1;
@@ -553,16 +557,22 @@ static struct ruvd_mpeg4 get_mpeg4_msg(struct ruvd_decoder *dec,
 {
        struct ruvd_mpeg4 result;
        unsigned i;
+
        memset(&result, 0, sizeof(result));
        result.decoded_pic_idx = dec->frame_number;
        for (i = 0; i < 2; ++i)
                result.ref_pic_idx[i] = get_ref_pic_idx(dec, pic->ref[i]);
 
+       result.variant_type = 0;
+       result.profile_and_level_indication = 0xF0; // ASP Level0
+
+       result.video_object_layer_verid = 0x5; // advanced simple
+       result.video_object_layer_shape = 0x0; // rectangular
+
        result.video_object_layer_width = dec->base.width;
-        result.video_object_layer_height = dec->base.height;
+       result.video_object_layer_height = dec->base.height;
 
        result.vop_time_increment_resolution = pic->vop_time_increment_resolution;
-       result.quant_type = pic->quant_type;
 
        result.flags |= pic->short_video_header << 0;
        //result.flags |= obmc_disable << 1;
@@ -570,19 +580,23 @@ static struct ruvd_mpeg4 get_mpeg4_msg(struct ruvd_decoder *dec,
         result.flags |= 1 << 3; // load_intra_quant_mat
        result.flags |= 1 << 4; // load_nonintra_quant_mat
        result.flags |= pic->quarter_sample << 5;
-       //result.flags |= complexity_estimation_disable << 6
+       result.flags |= 1 << 6; // complexity_estimation_disable
        result.flags |= pic->resync_marker_disable << 7;
        //result.flags |= data_partitioned << 8;
        //result.flags |= reversible_vlc << 9;
-       //result.flags |= newpred_enable << 10;
-       //result.flags |= reduced_resolution_vop_enable << 11;
+       result.flags |= 0 << 10; // newpred_enable
+       result.flags |= 0 << 11; // reduced_resolution_vop_enable
        //result.flags |= scalability << 12;
        //result.flags |= is_object_layer_identifier << 13;
        //result.flags |= fixed_vop_rate << 14;
        //result.flags |= newpred_segment_type << 15;
 
-       memcpy(&result.intra_quant_mat, pic->intra_matrix, 64);
-       memcpy(&result.nonintra_quant_mat, pic->non_intra_matrix, 64);
+       result.quant_type = pic->quant_type;
+
+       for (i = 0; i < 64; ++i) {
+               result.intra_quant_mat[i] = pic->intra_matrix[vl_zscan_normal[i]];
+               result.nonintra_quant_mat[i] = pic->non_intra_matrix[vl_zscan_normal[i]];
+       }
 
        /*
        int32_t         trd [2]
@@ -1076,7 +1090,6 @@ int ruvd_get_video_param(struct pipe_screen *screen,
                switch (u_reduce_video_profile(profile)) {
                case PIPE_VIDEO_CODEC_MPEG12:
                case PIPE_VIDEO_CODEC_MPEG4:
-                       /* TODO not all hw families support MPEG4 */
                case PIPE_VIDEO_CODEC_MPEG4_AVC:
                case PIPE_VIDEO_CODEC_VC1:
                        return true;
@@ -1092,9 +1105,9 @@ int ruvd_get_video_param(struct pipe_screen *screen,
        case PIPE_VIDEO_CAP_PREFERED_FORMAT:
                return PIPE_FORMAT_NV12;
        case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
-               return false;
+               return true;
        case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
-               return false; /* TODO: enable this */
+               return true;
        case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
                return true;
        default: