20 #include <va/va_dec_vp8.h>
31 return VA_INVALID_SURFACE;
40 VAPictureParameterBufferVP8 pp;
41 VAProbabilityDataBufferVP8
prob;
42 VAIQMatrixBufferVP8
quant;
47 pp = (VAPictureParameterBufferVP8) {
48 .frame_width = avctx->
width,
49 .frame_height = avctx->
height,
54 .out_of_loop_frame = VA_INVALID_SURFACE,
57 .key_frame = !
s->keyframe,
58 .version =
s->profile,
60 .segmentation_enabled =
s->segmentation.enabled,
61 .update_mb_segmentation_map =
s->segmentation.update_map,
62 .update_segment_feature_data =
s->segmentation.update_feature_data,
64 .filter_type =
s->filter.simple,
65 .sharpness_level =
s->filter.sharpness,
67 .loop_filter_adj_enable =
s->lf_delta.enabled,
68 .mode_ref_lf_delta_update =
s->lf_delta.update,
73 .mb_no_coeff_skip =
s->mbskip_enabled,
74 .loop_filter_disable =
s->filter.level == 0,
77 .prob_skip_false =
s->prob->mbskip,
78 .prob_intra =
s->prob->intra,
79 .prob_last =
s->prob->last,
80 .prob_gf =
s->prob->golden,
83 for (
i = 0;
i < 3;
i++)
84 pp.mb_segment_tree_probs[
i] =
s->prob->segmentid[
i];
87 if (
s->segmentation.enabled) {
88 pp.loop_filter_level[
i] =
s->segmentation.filter_level[
i];
89 if (!
s->segmentation.absolute_vals)
90 pp.loop_filter_level[
i] +=
s->filter.level;
92 pp.loop_filter_level[
i] =
s->filter.level;
97 for (
i = 0;
i < 4;
i++) {
98 pp.loop_filter_deltas_ref_frame[
i] =
s->lf_delta.ref[
i];
99 pp.loop_filter_deltas_mode[
i] =
s->lf_delta.mode[
i + 4];
103 static const uint8_t keyframe_y_mode_probs[4] = {
106 static const uint8_t keyframe_uv_mode_probs[3] = {
109 memcpy(pp.y_mode_probs, keyframe_y_mode_probs, 4);
110 memcpy(pp.uv_mode_probs, keyframe_uv_mode_probs, 3);
112 for (
i = 0;
i < 4;
i++)
113 pp.y_mode_probs[
i] =
s->prob->pred16x16[
i];
115 pp.uv_mode_probs[
i] =
s->prob->pred8x8c[
i];
117 for (
i = 0;
i < 2;
i++)
118 for (j = 0; j < 19; j++)
119 pp.mv_probs[
i][j] =
s->prob->mvc[
i][j];
121 pp.bool_coder_ctx.range =
s->coder_state_at_header_end.range;
122 pp.bool_coder_ctx.value =
s->coder_state_at_header_end.value;
123 pp.bool_coder_ctx.count =
s->coder_state_at_header_end.bit_count;
126 VAPictureParameterBufferType,
131 for (
i = 0;
i < 4;
i++) {
132 for (j = 0; j < 8; j++) {
133 static const int coeff_bands_inverse[8] = {
134 0, 1, 2, 3, 5, 6, 4, 15
136 int coeff_pos = coeff_bands_inverse[j];
138 for (k = 0; k < 3; k++) {
139 memcpy(
prob.dct_coeff_probs[
i][j][k],
140 s->prob->token[
i][coeff_pos][k], 11);
146 VAProbabilityBufferType,
151 for (
i = 0;
i < 4;
i++) {
152 int base_qi =
s->segmentation.base_quant[
i];
153 if (!
s->segmentation.absolute_vals)
154 base_qi +=
s->quant.yac_qi;
165 VAIQMatrixBufferType,
191 VASliceParameterBufferVP8
sp;
194 unsigned int header_size = 3 + 7 *
s->keyframe;
196 unsigned int data_size =
size - header_size;
198 sp = (VASliceParameterBufferVP8) {
199 .slice_data_size = data_size,
200 .slice_data_offset = 0,
201 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
203 .macroblock_offset = (8 * (
s->coder_state_at_header_end.input -
data) -
204 s->coder_state_at_header_end.bit_count - 8),
205 .num_of_partitions =
s->num_coeff_partitions + 1,
208 sp.partition_size[0] =
s->header_partition_size - ((
sp.macroblock_offset + 7) / 8);
209 for (
i = 0;
i < 8;
i++)
210 sp.partition_size[
i+1] =
s->coeff_partition_size[
i];
224 .
p.
name =
"vp8_vaapi",