hardware/intel/intel-driver
Revisión | 9170fed321780f394e8eae4a789c31120c4e957c (tree) |
---|---|
Tiempo | 2015-09-06 13:32:31 |
Autor | Xiang, Haihao <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
encode/hevc: Check slice type first in case user passes wrong parameters to driver
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
@@ -497,6 +497,7 @@ intel_encoder_check_hevc_parameter(VADriverContextP ctx, | ||
497 | 497 | struct object_surface *obj_surface; |
498 | 498 | struct object_buffer *obj_buffer; |
499 | 499 | VAEncPictureParameterBufferHEVC *pic_param = (VAEncPictureParameterBufferHEVC *)encode_state->pic_param_ext->buffer; |
500 | + VAEncSliceParameterBufferHEVC *slice_param; | |
500 | 501 | int i; |
501 | 502 | |
502 | 503 | assert(!(pic_param->decoded_curr_pic.flags & VA_PICTURE_HEVC_INVALID)); |
@@ -539,7 +540,18 @@ intel_encoder_check_hevc_parameter(VADriverContextP ctx, | ||
539 | 540 | |
540 | 541 | for ( ; i < 15; i++) |
541 | 542 | encode_state->reference_objects[i] = NULL; |
542 | - | |
543 | + | |
544 | + for (i = 0; i < encode_state->num_slice_params_ext; i++) { | |
545 | + slice_param = (VAEncSliceParameterBufferHEVC *)encode_state->slice_params_ext[i]->buffer; | |
546 | + | |
547 | + if (slice_param->slice_type != HEVC_SLICE_I && | |
548 | + slice_param->slice_type != HEVC_SLICE_P && | |
549 | + slice_param->slice_type != HEVC_SLICE_B) | |
550 | + goto error; | |
551 | + | |
552 | + /* TODO: add more check here */ | |
553 | + } | |
554 | + | |
543 | 555 | return VA_STATUS_SUCCESS; |
544 | 556 | |
545 | 557 | error: |