2 * Copyright (C) 2006-2012 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
28 #include "intel_batchbuffer.h"
29 #include "i965_drv_video.h"
30 #include "i965_decoder_utils.h"
31 #include "i965_defines.h"
33 /* Set reference surface if backing store exists */
36 struct i965_driver_data *i965,
37 GenFrameStore *ref_frame,
38 VASurfaceID va_surface,
39 struct object_surface *obj_surface
42 if (va_surface == VA_INVALID_ID)
45 if (!obj_surface || !obj_surface->bo)
48 ref_frame->surface_id = va_surface;
49 ref_frame->obj_surface = obj_surface;
53 /* Check wether codec layer incorrectly fills in slice_vertical_position */
55 mpeg2_wa_slice_vertical_position(
56 struct decode_state *decode_state,
57 VAPictureParameterBufferMPEG2 *pic_param
60 unsigned int i, j, mb_height, vpos, last_vpos = 0;
62 /* Assume progressive sequence if we got a progressive frame */
63 if (pic_param->picture_coding_extension.bits.progressive_frame)
66 /* Wait for a field coded picture */
67 if (pic_param->picture_coding_extension.bits.picture_structure == MPEG_FRAME)
70 assert(decode_state && decode_state->slice_params);
72 mb_height = (pic_param->vertical_size + 31) / 32;
74 for (j = 0; j < decode_state->num_slice_params; j++) {
75 struct buffer_store * const buffer_store =
76 decode_state->slice_params[j];
78 for (i = 0; i < buffer_store->num_elements; i++) {
79 VASliceParameterBufferMPEG2 * const slice_param =
80 ((VASliceParameterBufferMPEG2 *)buffer_store->buffer) + i;
82 vpos = slice_param->slice_vertical_position;
83 if (vpos >= mb_height || vpos == last_vpos + 2) {
84 WARN_ONCE("codec layer incorrectly fills in MPEG-2 slice_vertical_position. Workaround applied\n");
93 /* Build MPEG-2 reference frames array */
95 mpeg2_set_reference_surfaces(
97 GenFrameStore ref_frames[MAX_GEN_REFERENCE_FRAMES],
98 struct decode_state *decode_state,
99 VAPictureParameterBufferMPEG2 *pic_param
102 struct i965_driver_data * const i965 = i965_driver_data(ctx);
103 VASurfaceID va_surface;
104 unsigned pic_structure, is_second_field, n = 0;
105 struct object_surface *obj_surface;
107 pic_structure = pic_param->picture_coding_extension.bits.picture_structure;
108 is_second_field = pic_structure != MPEG_FRAME &&
109 !pic_param->picture_coding_extension.bits.is_first_field;
111 ref_frames[0].surface_id = VA_INVALID_ID;
112 ref_frames[0].obj_surface = NULL;
114 /* Reference frames are indexed by frame store ID (0:top, 1:bottom) */
115 switch (pic_param->picture_coding_type) {
117 if (is_second_field && pic_structure == MPEG_BOTTOM_FIELD) {
118 va_surface = decode_state->current_render_target;
119 obj_surface = decode_state->render_object;
120 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
122 va_surface = pic_param->forward_reference_picture;
123 obj_surface = decode_state->reference_objects[0];
124 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
128 va_surface = pic_param->forward_reference_picture;
129 obj_surface = decode_state->reference_objects[0];
130 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
131 va_surface = pic_param->backward_reference_picture;
132 obj_surface = decode_state->reference_objects[1];
133 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
138 ref_frames[n].obj_surface = ref_frames[0].obj_surface;
139 ref_frames[n++].surface_id = ref_frames[0].surface_id;
142 if (pic_param->picture_coding_extension.bits.progressive_frame)
145 ref_frames[2].surface_id = VA_INVALID_ID;
146 ref_frames[2].obj_surface = NULL;
148 /* Bottom field pictures used as reference */
149 switch (pic_param->picture_coding_type) {
151 if (is_second_field && pic_structure == MPEG_TOP_FIELD) {
152 va_surface = decode_state->current_render_target;
153 obj_surface = decode_state->render_object;
154 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
156 va_surface = pic_param->forward_reference_picture;
157 obj_surface = decode_state->reference_objects[0];
158 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
162 va_surface = pic_param->forward_reference_picture;
163 obj_surface = decode_state->reference_objects[0];
164 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
165 va_surface = pic_param->backward_reference_picture;
166 obj_surface = decode_state->reference_objects[1];
167 n += set_ref_frame(i965, &ref_frames[n], va_surface, obj_surface);
172 ref_frames[n].obj_surface = ref_frames[2].obj_surface;
173 ref_frames[n++].surface_id = ref_frames[2].surface_id;
177 /* Generate flat scaling matrices for H.264 decoding */
179 avc_gen_default_iq_matrix(VAIQMatrixBufferH264 *iq_matrix)
182 memset(&iq_matrix->ScalingList4x4, 16, sizeof(iq_matrix->ScalingList4x4));
185 memset(&iq_matrix->ScalingList8x8, 16, sizeof(iq_matrix->ScalingList8x8));
188 /* Get first macroblock bit offset for BSD, minus EPB count (AVC) */
189 /* XXX: slice_data_bit_offset does not account for EPB */
191 avc_get_first_mb_bit_offset(
192 dri_bo *slice_data_bo,
193 VASliceParameterBufferH264 *slice_param,
194 unsigned int mode_flag
197 unsigned int slice_data_bit_offset = slice_param->slice_data_bit_offset;
199 if (mode_flag == ENTROPY_CABAC)
200 slice_data_bit_offset = ALIGN(slice_data_bit_offset, 0x8);
201 return slice_data_bit_offset;
204 /* Get first macroblock bit offset for BSD, with EPB count (AVC) */
205 /* XXX: slice_data_bit_offset does not account for EPB */
207 avc_get_first_mb_bit_offset_with_epb(
208 dri_bo *slice_data_bo,
209 VASliceParameterBufferH264 *slice_param,
210 unsigned int mode_flag
213 unsigned int in_slice_data_bit_offset = slice_param->slice_data_bit_offset;
214 unsigned int out_slice_data_bit_offset;
215 unsigned int i, j, n, buf_size, data_size, header_size;
219 header_size = slice_param->slice_data_bit_offset / 8;
220 data_size = slice_param->slice_data_size - slice_param->slice_data_offset;
221 buf_size = (header_size * 3 + 1) / 2; // Max possible header size (x1.5)
223 if (buf_size > data_size)
224 buf_size = data_size;
226 buf = alloca(buf_size);
227 ret = dri_bo_get_subdata(
228 slice_data_bo, slice_param->slice_data_offset,
233 for (i = 2, j = 2, n = 0; i < buf_size && j < header_size; i++, j++) {
234 if (buf[i] == 0x03 && buf[i - 1] == 0x00 && buf[i - 2] == 0x00)
238 out_slice_data_bit_offset = in_slice_data_bit_offset + n * 8;
240 if (mode_flag == ENTROPY_CABAC)
241 out_slice_data_bit_offset = ALIGN(out_slice_data_bit_offset, 0x8);
242 return out_slice_data_bit_offset;
245 static inline uint8_t
246 get_ref_idx_state_1(const VAPictureH264 *va_pic, unsigned int frame_store_id)
248 const unsigned int is_long_term =
249 !!(va_pic->flags & VA_PICTURE_H264_LONG_TERM_REFERENCE);
250 const unsigned int is_top_field =
251 !!(va_pic->flags & VA_PICTURE_H264_TOP_FIELD);
252 const unsigned int is_bottom_field =
253 !!(va_pic->flags & VA_PICTURE_H264_BOTTOM_FIELD);
255 return ((is_long_term << 6) |
256 ((is_top_field ^ is_bottom_field ^ 1) << 5) |
257 (frame_store_id << 1) |
258 ((is_top_field ^ 1) & is_bottom_field));
261 /* Fill in Reference List Entries (Gen5+: ILK, SNB, IVB) */
263 gen5_fill_avc_ref_idx_state(
265 const VAPictureH264 ref_list[32],
266 unsigned int ref_list_count,
267 const GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
270 unsigned int i, n, frame_idx;
272 for (i = 0, n = 0; i < ref_list_count; i++) {
273 const VAPictureH264 * const va_pic = &ref_list[i];
275 if (va_pic->flags & VA_PICTURE_H264_INVALID)
278 for (frame_idx = 0; frame_idx < MAX_GEN_REFERENCE_FRAMES; frame_idx++) {
279 const GenFrameStore * const fs = &frame_store[frame_idx];
280 if (fs->surface_id != VA_INVALID_ID &&
281 fs->surface_id == va_pic->picture_id) {
282 assert(frame_idx == fs->frame_store_id);
286 assert(frame_idx < MAX_GEN_REFERENCE_FRAMES);
287 state[n++] = get_ref_idx_state_1(va_pic, frame_idx);
294 /* Emit Reference List Entries (Gen6+: SNB, IVB) */
296 gen6_send_avc_ref_idx_state_1(
297 struct intel_batchbuffer *batch,
299 const VAPictureH264 *ref_list,
300 unsigned int ref_list_count,
301 const GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
304 uint8_t ref_idx_state[32];
306 BEGIN_BCS_BATCH(batch, 10);
307 OUT_BCS_BATCH(batch, MFX_AVC_REF_IDX_STATE | (10 - 2));
308 OUT_BCS_BATCH(batch, list);
309 gen5_fill_avc_ref_idx_state(
311 ref_list, ref_list_count,
314 intel_batchbuffer_data(batch, ref_idx_state, sizeof(ref_idx_state));
315 ADVANCE_BCS_BATCH(batch);
319 gen6_send_avc_ref_idx_state(
320 struct intel_batchbuffer *batch,
321 const VASliceParameterBufferH264 *slice_param,
322 const GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
325 if (slice_param->slice_type == SLICE_TYPE_I ||
326 slice_param->slice_type == SLICE_TYPE_SI)
330 gen6_send_avc_ref_idx_state_1(
332 slice_param->RefPicList0, slice_param->num_ref_idx_l0_active_minus1 + 1,
336 if (slice_param->slice_type != SLICE_TYPE_B)
340 gen6_send_avc_ref_idx_state_1(
342 slice_param->RefPicList1, slice_param->num_ref_idx_l1_active_minus1 + 1,
348 intel_update_avc_frame_store_index(VADriverContextP ctx,
349 struct decode_state *decode_state,
350 VAPictureParameterBufferH264 *pic_param,
351 GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES])
355 assert(MAX_GEN_REFERENCE_FRAMES == ARRAY_ELEMS(pic_param->ReferenceFrames));
357 for (i = 0; i < MAX_GEN_REFERENCE_FRAMES; i++) {
360 if (frame_store[i].surface_id == VA_INVALID_ID ||
361 frame_store[i].obj_surface == NULL)
364 assert(frame_store[i].frame_store_id != -1);
366 for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
367 VAPictureH264 *ref_pic = &pic_param->ReferenceFrames[j];
368 if (ref_pic->flags & VA_PICTURE_H264_INVALID)
371 if (frame_store[i].surface_id == ref_pic->picture_id) {
377 /* remove it from the internal DPB */
379 struct object_surface *obj_surface = frame_store[i].obj_surface;
381 obj_surface->flags &= ~SURFACE_REFERENCED;
383 if ((obj_surface->flags & SURFACE_ALL_MASK) == SURFACE_DISPLAYED) {
384 dri_bo_unreference(obj_surface->bo);
385 obj_surface->bo = NULL;
386 obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
389 if (obj_surface->free_private_data)
390 obj_surface->free_private_data(&obj_surface->private_data);
392 frame_store[i].surface_id = VA_INVALID_ID;
393 frame_store[i].frame_store_id = -1;
394 frame_store[i].obj_surface = NULL;
398 for (i = 0; i < MAX_GEN_REFERENCE_FRAMES; i++) {
399 VAPictureH264 *ref_pic = &pic_param->ReferenceFrames[i];
402 if (ref_pic->flags & VA_PICTURE_H264_INVALID ||
403 ref_pic->picture_id == VA_INVALID_SURFACE ||
404 decode_state->reference_objects[i] == NULL)
407 for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
408 if (frame_store[j].surface_id == ref_pic->picture_id) {
414 /* add the new reference frame into the internal DPB */
417 struct object_surface *obj_surface = decode_state->reference_objects[i];
420 * Sometimes a dummy frame comes from the upper layer library, call i965_check_alloc_surface_bo()
421 * to ake sure the store buffer is allocated for this reference frame
423 i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N', 'V', '1', '2'), SUBSAMPLE_YUV420);
425 /* Find a free frame store index */
426 for (frame_idx = 0; frame_idx < MAX_GEN_REFERENCE_FRAMES; frame_idx++) {
427 for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
428 if (frame_store[j].surface_id == VA_INVALID_ID ||
429 frame_store[j].obj_surface == NULL)
432 if (frame_store[j].frame_store_id == frame_idx) /* the store index is in use */
436 if (j == MAX_GEN_REFERENCE_FRAMES)
440 assert(frame_idx < MAX_GEN_REFERENCE_FRAMES);
442 for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
443 if (frame_store[j].surface_id == VA_INVALID_ID ||
444 frame_store[j].obj_surface == NULL) {
445 frame_store[j].surface_id = ref_pic->picture_id;
446 frame_store[j].frame_store_id = frame_idx;
447 frame_store[j].obj_surface = obj_surface;
455 for (i = 0; i < MAX_GEN_REFERENCE_FRAMES - 1; i++) {
456 if (frame_store[i].surface_id != VA_INVALID_ID &&
457 frame_store[i].obj_surface != NULL &&
458 frame_store[i].frame_store_id == i)
461 for (j = i + 1; j < MAX_GEN_REFERENCE_FRAMES; j++) {
462 if (frame_store[j].surface_id != VA_INVALID_ID &&
463 frame_store[j].obj_surface != NULL &&
464 frame_store[j].frame_store_id == i) {
465 VASurfaceID id = frame_store[i].surface_id;
466 int frame_idx = frame_store[i].frame_store_id;
467 struct object_surface *obj_surface = frame_store[i].obj_surface;
469 frame_store[i].surface_id = frame_store[j].surface_id;
470 frame_store[i].frame_store_id = frame_store[j].frame_store_id;
471 frame_store[i].obj_surface = frame_store[j].obj_surface;
472 frame_store[j].surface_id = id;
473 frame_store[j].frame_store_id = frame_idx;
474 frame_store[j].obj_surface = obj_surface;
482 intel_update_vc1_frame_store_index(VADriverContextP ctx,
483 struct decode_state *decode_state,
484 VAPictureParameterBufferVC1 *pic_param,
485 GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES])
487 struct object_surface *obj_surface;
490 obj_surface = decode_state->reference_objects[0];
492 if (pic_param->forward_reference_picture == VA_INVALID_ID ||
495 frame_store[0].surface_id = VA_INVALID_ID;
496 frame_store[0].obj_surface = NULL;
498 frame_store[0].surface_id = pic_param->forward_reference_picture;
499 frame_store[0].obj_surface = obj_surface;
502 obj_surface = decode_state->reference_objects[1];
504 if (pic_param->backward_reference_picture == VA_INVALID_ID ||
507 frame_store[1].surface_id = frame_store[0].surface_id;
508 frame_store[1].obj_surface = frame_store[0].obj_surface;
510 frame_store[1].surface_id = pic_param->backward_reference_picture;
511 frame_store[1].obj_surface = obj_surface;
513 for (i = 2; i < MAX_GEN_REFERENCE_FRAMES; i++) {
514 frame_store[i].surface_id = frame_store[i % 2].surface_id;
515 frame_store[i].obj_surface = frame_store[i % 2].obj_surface;
521 intel_decoder_check_avc_parameter(VADriverContextP ctx,
522 struct decode_state *decode_state)
524 struct i965_driver_data *i965 = i965_driver_data(ctx);
525 VAPictureParameterBufferH264 *pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
526 struct object_surface *obj_surface;
529 assert(!(pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID));
530 assert(pic_param->CurrPic.picture_id != VA_INVALID_SURFACE);
532 if (pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID ||
533 pic_param->CurrPic.picture_id == VA_INVALID_SURFACE)
536 assert(pic_param->CurrPic.picture_id == decode_state->current_render_target);
538 if (pic_param->CurrPic.picture_id != decode_state->current_render_target)
541 for (i = 0; i < 16; i++) {
542 if (pic_param->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID ||
543 pic_param->ReferenceFrames[i].picture_id == VA_INVALID_SURFACE)
546 obj_surface = SURFACE(pic_param->ReferenceFrames[i].picture_id);
552 if (!obj_surface->bo) { /* a reference frame without store buffer */
553 WARN_ONCE("Invalid reference frame!!!\n");
556 decode_state->reference_objects[i] = obj_surface;
561 decode_state->reference_objects[i] = NULL;
563 return VA_STATUS_SUCCESS;
566 return VA_STATUS_ERROR_INVALID_PARAMETER;
570 intel_decoder_check_mpeg2_parameter(VADriverContextP ctx,
571 struct decode_state *decode_state)
573 struct i965_driver_data *i965 = i965_driver_data(ctx);
574 VAPictureParameterBufferMPEG2 *pic_param = (VAPictureParameterBufferMPEG2 *)decode_state->pic_param->buffer;
575 struct object_surface *obj_surface;
578 if (pic_param->picture_coding_type == MPEG_I_PICTURE) {
579 } else if (pic_param->picture_coding_type == MPEG_P_PICTURE) {
580 obj_surface = SURFACE(pic_param->forward_reference_picture);
582 if (!obj_surface || !obj_surface->bo)
583 decode_state->reference_objects[i++] = NULL;
585 decode_state->reference_objects[i++] = obj_surface;
586 } else if (pic_param->picture_coding_type == MPEG_B_PICTURE) {
587 obj_surface = SURFACE(pic_param->forward_reference_picture);
589 if (!obj_surface || !obj_surface->bo)
590 decode_state->reference_objects[i++] = NULL;
592 decode_state->reference_objects[i++] = obj_surface;
594 obj_surface = SURFACE(pic_param->backward_reference_picture);
596 if (!obj_surface || !obj_surface->bo)
597 decode_state->reference_objects[i++] = NULL;
599 decode_state->reference_objects[i++] = obj_surface;
604 decode_state->reference_objects[i] = NULL;
606 return VA_STATUS_SUCCESS;
609 return VA_STATUS_ERROR_INVALID_PARAMETER;
613 intel_decoder_check_vc1_parameter(VADriverContextP ctx,
614 struct decode_state *decode_state)
616 struct i965_driver_data *i965 = i965_driver_data(ctx);
617 VAPictureParameterBufferVC1 *pic_param = (VAPictureParameterBufferVC1 *)decode_state->pic_param->buffer;
618 struct object_surface *obj_surface;
621 if (pic_param->picture_fields.bits.picture_type == 0 ||
622 pic_param->picture_fields.bits.picture_type == 3) {
623 } else if (pic_param->picture_fields.bits.picture_type == 1 ||
624 pic_param->picture_fields.bits.picture_type == 4) {
625 obj_surface = SURFACE(pic_param->forward_reference_picture);
627 if (!obj_surface || !obj_surface->bo)
628 decode_state->reference_objects[i++] = NULL;
630 decode_state->reference_objects[i++] = obj_surface;
631 } else if (pic_param->picture_fields.bits.picture_type == 2) {
632 obj_surface = SURFACE(pic_param->forward_reference_picture);
634 if (!obj_surface || !obj_surface->bo)
635 decode_state->reference_objects[i++] = NULL;
637 decode_state->reference_objects[i++] = obj_surface;
639 obj_surface = SURFACE(pic_param->backward_reference_picture);
641 if (!obj_surface || !obj_surface->bo)
642 decode_state->reference_objects[i++] = NULL;
644 decode_state->reference_objects[i++] = obj_surface;
649 decode_state->reference_objects[i] = NULL;
651 return VA_STATUS_SUCCESS;
654 return VA_STATUS_ERROR_INVALID_PARAMETER;
658 intel_decoder_check_vp8_parameter(VADriverContextP ctx,
659 struct decode_state *decode_state)
661 struct i965_driver_data *i965 = i965_driver_data(ctx);
662 VAPictureParameterBufferVP8 *pic_param = (VAPictureParameterBufferVP8 *)decode_state->pic_param->buffer;
663 struct object_surface *obj_surface;
666 if (pic_param->last_ref_frame != VA_INVALID_SURFACE) {
667 obj_surface = SURFACE(pic_param->last_ref_frame);
669 if (obj_surface && obj_surface->bo)
670 decode_state->reference_objects[i++] = obj_surface;
672 decode_state->reference_objects[i++] = NULL;
675 if (pic_param->golden_ref_frame != VA_INVALID_SURFACE) {
676 obj_surface = SURFACE(pic_param->golden_ref_frame);
678 if (obj_surface && obj_surface->bo)
679 decode_state->reference_objects[i++] = obj_surface;
681 decode_state->reference_objects[i++] = NULL;
684 if (pic_param->alt_ref_frame != VA_INVALID_SURFACE) {
685 obj_surface = SURFACE(pic_param->alt_ref_frame);
687 if (obj_surface && obj_surface->bo)
688 decode_state->reference_objects[i++] = obj_surface;
690 decode_state->reference_objects[i++] = NULL;
694 decode_state->reference_objects[i] = NULL;
696 return VA_STATUS_SUCCESS;
700 intel_decoder_sanity_check_input(VADriverContextP ctx,
702 struct decode_state *decode_state)
704 struct i965_driver_data *i965 = i965_driver_data(ctx);
705 struct object_surface *obj_surface;
706 VAStatus vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
708 if (decode_state->current_render_target == VA_INVALID_SURFACE)
711 obj_surface = SURFACE(decode_state->current_render_target);
716 decode_state->render_object = obj_surface;
719 case VAProfileMPEG2Simple:
720 case VAProfileMPEG2Main:
721 vaStatus = intel_decoder_check_mpeg2_parameter(ctx, decode_state);
724 case VAProfileH264ConstrainedBaseline:
725 case VAProfileH264Main:
726 case VAProfileH264High:
727 vaStatus = intel_decoder_check_avc_parameter(ctx, decode_state);
730 case VAProfileVC1Simple:
731 case VAProfileVC1Main:
732 case VAProfileVC1Advanced:
733 vaStatus = intel_decoder_check_vc1_parameter(ctx, decode_state);
736 case VAProfileJPEGBaseline:
737 vaStatus = VA_STATUS_SUCCESS;
740 case VAProfileVP8Version0_3:
741 vaStatus = intel_decoder_check_vp8_parameter(ctx, decode_state);
745 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
754 * Return the next slice paramter
757 * slice_param: the current slice
758 * *group_idx & *element_idx the current slice position in slice groups
760 * Return the next slice parameter
761 * *group_idx & *element_idx the next slice position in slice groups,
762 * if the next slice is NULL, *group_idx & *element_idx will be ignored
764 VASliceParameterBufferMPEG2 *
765 intel_mpeg2_find_next_slice(struct decode_state *decode_state,
766 VAPictureParameterBufferMPEG2 *pic_param,
767 VASliceParameterBufferMPEG2 *slice_param,
771 VASliceParameterBufferMPEG2 *next_slice_param;
772 unsigned int width_in_mbs = ALIGN(pic_param->horizontal_size, 16) / 16;
773 int j = *group_idx, i = *element_idx + 1;
775 for (; j < decode_state->num_slice_params; j++) {
776 for (; i < decode_state->slice_params[j]->num_elements; i++) {
777 next_slice_param = ((VASliceParameterBufferMPEG2 *)decode_state->slice_params[j]->buffer) + i;
779 if ((next_slice_param->slice_vertical_position * width_in_mbs + next_slice_param->slice_horizontal_position) >=
780 (slice_param->slice_vertical_position * width_in_mbs + slice_param->slice_horizontal_position)) {
784 return next_slice_param;