Mercurial > libavcodec.hg
comparison vaapi_h264.c @ 10829:46a247e54d6e libavcodec
Export get_slice_type() as ff_h264_get_slice_type().
Patch by Laurent Aimar <fenrir at videolan dot org>.
author | ramiro |
---|---|
date | Sat, 09 Jan 2010 16:20:41 +0000 |
parents | a3af696f8499 |
children | 776dba50775c |
comparison
equal
deleted
inserted
replaced
10828:d0657e337f91 | 10829:46a247e54d6e |
---|---|
25 | 25 |
26 /** @file | 26 /** @file |
27 * This file implements the glue code between FFmpeg's and VA API's | 27 * This file implements the glue code between FFmpeg's and VA API's |
28 * structures for H.264 decoding. | 28 * structures for H.264 decoding. |
29 */ | 29 */ |
30 | |
31 /** Reconstructs bitstream slice_type. */ | |
32 static int get_slice_type(H264Context *h) | |
33 { | |
34 switch (h->slice_type) { | |
35 case FF_P_TYPE: return 0; | |
36 case FF_B_TYPE: return 1; | |
37 case FF_I_TYPE: return 2; | |
38 case FF_SP_TYPE: return 3; | |
39 case FF_SI_TYPE: return 4; | |
40 default: return -1; | |
41 } | |
42 } | |
43 | 30 |
44 /** | 31 /** |
45 * Initializes an empty VA API picture. | 32 * Initializes an empty VA API picture. |
46 * | 33 * |
47 * VA API requires a fixed-size reference picture array. | 34 * VA API requires a fixed-size reference picture array. |
321 slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); | 308 slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); |
322 if (!slice_param) | 309 if (!slice_param) |
323 return -1; | 310 return -1; |
324 slice_param->slice_data_bit_offset = get_bits_count(&h->s.gb) + 8; /* bit buffer started beyond nal_unit_type */ | 311 slice_param->slice_data_bit_offset = get_bits_count(&h->s.gb) + 8; /* bit buffer started beyond nal_unit_type */ |
325 slice_param->first_mb_in_slice = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x; | 312 slice_param->first_mb_in_slice = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x; |
326 slice_param->slice_type = get_slice_type(h); | 313 slice_param->slice_type = ff_h264_get_slice_type(h); |
327 slice_param->direct_spatial_mv_pred_flag = h->slice_type == FF_B_TYPE ? h->direct_spatial_mv_pred : 0; | 314 slice_param->direct_spatial_mv_pred_flag = h->slice_type == FF_B_TYPE ? h->direct_spatial_mv_pred : 0; |
328 slice_param->num_ref_idx_l0_active_minus1 = h->list_count > 0 ? h->ref_count[0] - 1 : 0; | 315 slice_param->num_ref_idx_l0_active_minus1 = h->list_count > 0 ? h->ref_count[0] - 1 : 0; |
329 slice_param->num_ref_idx_l1_active_minus1 = h->list_count > 1 ? h->ref_count[1] - 1 : 0; | 316 slice_param->num_ref_idx_l1_active_minus1 = h->list_count > 1 ? h->ref_count[1] - 1 : 0; |
330 slice_param->cabac_init_idc = h->cabac_init_idc; | 317 slice_param->cabac_init_idc = h->cabac_init_idc; |
331 slice_param->slice_qp_delta = s->qscale - h->pps.init_qp; | 318 slice_param->slice_qp_delta = s->qscale - h->pps.init_qp; |