annotate vaapi_vc1.c @ 11602:da95280256b4 libavcodec

Remove redundant file descriptions from copyright headers. File description is only kept in the @file doxy.
author stefano
date Sun, 11 Apr 2010 20:04:11 +0000
parents 8a4984c5cacc
children fdafbcef52f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
1 /*
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
2 * VC-1 HW decode acceleration through VA API
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
3 *
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
4 * Copyright (C) 2008-2009 Splitted-Desktop Systems
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
5 *
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
6 * This file is part of FFmpeg.
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
7 *
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
12 *
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
16 * Lesser General Public License for more details.
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
17 *
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
21 */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
22
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
23 #include "vaapi_internal.h"
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
24 #include "vc1.h"
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
25 #include "vc1data.h"
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
26
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
27 /** Translates FFmpeg MV modes to VA API */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
28 static int get_VAMvModeVC1(enum MVModes mv_mode)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
29 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
30 switch (mv_mode) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
31 case MV_PMODE_1MV_HPEL_BILIN: return VAMvMode1MvHalfPelBilinear;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
32 case MV_PMODE_1MV: return VAMvMode1Mv;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
33 case MV_PMODE_1MV_HPEL: return VAMvMode1MvHalfPel;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
34 case MV_PMODE_MIXED_MV: return VAMvModeMixedMv;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
35 case MV_PMODE_INTENSITY_COMP: return VAMvModeIntensityCompensation;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
36 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
37 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
38 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
39
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
40 /** Checks whether the MVTYPEMB bitplane is present */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
41 static inline int vc1_has_MVTYPEMB_bitplane(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
42 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
43 if (v->mv_type_is_raw)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
44 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
45 return (v->s.pict_type == FF_P_TYPE &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
46 (v->mv_mode == MV_PMODE_MIXED_MV ||
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
47 (v->mv_mode == MV_PMODE_INTENSITY_COMP &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
48 v->mv_mode2 == MV_PMODE_MIXED_MV)));
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
49 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
50
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
51 /** Checks whether the SKIPMB bitplane is present */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
52 static inline int vc1_has_SKIPMB_bitplane(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
53 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
54 if (v->skip_is_raw)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
55 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
56 return (v->s.pict_type == FF_P_TYPE ||
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
57 (v->s.pict_type == FF_B_TYPE && !v->bi_type));
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
58 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
59
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
60 /** Checks whether the DIRECTMB bitplane is present */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
61 static inline int vc1_has_DIRECTMB_bitplane(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
62 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
63 if (v->dmb_is_raw)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
64 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
65 return v->s.pict_type == FF_B_TYPE && !v->bi_type;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
66 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
67
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
68 /** Checks whether the ACPRED bitplane is present */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
69 static inline int vc1_has_ACPRED_bitplane(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
70 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
71 if (v->acpred_is_raw)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
72 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
73 return (v->profile == PROFILE_ADVANCED &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
74 (v->s.pict_type == FF_I_TYPE ||
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
75 (v->s.pict_type == FF_B_TYPE && v->bi_type)));
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
76 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
77
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
78 /** Check whether the OVERFLAGS bitplane is present */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
79 static inline int vc1_has_OVERFLAGS_bitplane(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
80 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
81 if (v->overflg_is_raw)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
82 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
83 return (v->profile == PROFILE_ADVANCED &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
84 (v->s.pict_type == FF_I_TYPE ||
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
85 (v->s.pict_type == FF_B_TYPE && v->bi_type)) &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
86 (v->overlap && v->pq <= 8) &&
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
87 v->condover == CONDOVER_SELECT);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
88 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
89
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
90 /** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
91 static int vc1_get_PTYPE(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
92 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
93 MpegEncContext * const s = &v->s;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
94 switch (s->pict_type) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
95 case FF_I_TYPE: return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
96 case FF_P_TYPE: return v->p_frame_skipped ? 4 : 1;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
97 case FF_B_TYPE: return v->bi_type ? 3 : 2;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
98 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
99 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
100 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
101
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
102 /** Reconstruct bitstream MVMODE (7.1.1.32) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
103 static inline VAMvModeVC1 vc1_get_MVMODE(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
104 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
105 if (v->s.pict_type == FF_P_TYPE ||
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
106 (v->s.pict_type == FF_B_TYPE && !v->bi_type))
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
107 return get_VAMvModeVC1(v->mv_mode);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
108 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
109 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
110
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
111 /** Reconstruct bitstream MVMODE2 (7.1.1.33) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
112 static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
113 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
114 if (v->s.pict_type == FF_P_TYPE && v->mv_mode == MV_PMODE_INTENSITY_COMP)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
115 return get_VAMvModeVC1(v->mv_mode2);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
116 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
117 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
118
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
119 /** Pack FFmpeg bitplanes into a VABitPlaneBuffer element */
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
120 static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride)
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
121 {
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
122 const int bitplane_index = n / 2;
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
123 const int ff_bp_index = y * stride + x;
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
124 uint8_t v = 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
125 if (ff_bp[0])
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
126 v = ff_bp[0][ff_bp_index];
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
127 if (ff_bp[1])
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
128 v |= ff_bp[1][ff_bp_index] << 1;
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
129 if (ff_bp[2])
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
130 v |= ff_bp[2][ff_bp_index] << 2;
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
131 bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
132 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
133
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
134 static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
135 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
136 VC1Context * const v = avctx->priv_data;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
137 MpegEncContext * const s = &v->s;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
138 struct vaapi_context * const vactx = avctx->hwaccel_context;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
139 VAPictureParameterBufferVC1 *pic_param;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
140
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
141 dprintf(avctx, "vaapi_vc1_start_frame()\n");
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
142
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
143 vactx->slice_param_size = sizeof(VASliceParameterBufferVC1);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
144
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
145 /* Fill in VAPictureParameterBufferVC1 */
10724
de8d07d87c45 Rename ff_vaapi_alloc_picture() to ff_vaapi_alloc_pic_param().
gb
parents: 10723
diff changeset
146 pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
147 if (!pic_param)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
148 return -1;
10725
3b6b7fe1c27c Use VA_INVALID_ID instead of hard coded values.
gb
parents: 10724
diff changeset
149 pic_param->forward_reference_picture = VA_INVALID_ID;
3b6b7fe1c27c Use VA_INVALID_ID instead of hard coded values.
gb
parents: 10724
diff changeset
150 pic_param->backward_reference_picture = VA_INVALID_ID;
3b6b7fe1c27c Use VA_INVALID_ID instead of hard coded values.
gb
parents: 10724
diff changeset
151 pic_param->inloop_decoded_picture = VA_INVALID_ID;
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
152 pic_param->sequence_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
153 pic_param->sequence_fields.bits.pulldown = v->broadcast;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
154 pic_param->sequence_fields.bits.interlace = v->interlace;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
155 pic_param->sequence_fields.bits.tfcntrflag = v->tfcntrflag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
156 pic_param->sequence_fields.bits.finterpflag = v->finterpflag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
157 pic_param->sequence_fields.bits.psf = v->psf;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
158 pic_param->sequence_fields.bits.multires = v->multires;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
159 pic_param->sequence_fields.bits.overlap = v->overlap;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
160 pic_param->sequence_fields.bits.syncmarker = s->resync_marker;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
161 pic_param->sequence_fields.bits.rangered = v->rangered;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
162 pic_param->sequence_fields.bits.max_b_frames = s->avctx->max_b_frames;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
163 pic_param->coded_width = s->avctx->coded_width;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
164 pic_param->coded_height = s->avctx->coded_height;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
165 pic_param->entrypoint_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
166 pic_param->entrypoint_fields.bits.broken_link = v->broken_link;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
167 pic_param->entrypoint_fields.bits.closed_entry = v->closed_entry;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
168 pic_param->entrypoint_fields.bits.panscan_flag = v->panscanflag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
169 pic_param->entrypoint_fields.bits.loopfilter = s->loop_filter;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
170 pic_param->conditional_overlap_flag = v->condover;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
171 pic_param->fast_uvmc_flag = v->fastuvmc;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
172 pic_param->range_mapping_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
173 pic_param->range_mapping_fields.bits.luma_flag = v->range_mapy_flag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
174 pic_param->range_mapping_fields.bits.luma = v->range_mapy;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
175 pic_param->range_mapping_fields.bits.chroma_flag = v->range_mapuv_flag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
176 pic_param->range_mapping_fields.bits.chroma = v->range_mapuv;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
177 pic_param->b_picture_fraction = v->bfraction_lut_index;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
178 pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
179 pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
180 pic_param->range_reduction_frame = v->rangeredfrm;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
181 pic_param->rounding_control = v->rnd;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
182 pic_param->post_processing = v->postproc;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
183 pic_param->picture_resolution_index = v->respic;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
184 pic_param->luma_scale = v->lumscale;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
185 pic_param->luma_shift = v->lumshift;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
186 pic_param->picture_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
187 pic_param->picture_fields.bits.picture_type = vc1_get_PTYPE(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
188 pic_param->picture_fields.bits.frame_coding_mode = v->fcm;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
189 pic_param->picture_fields.bits.top_field_first = v->tff;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
190 pic_param->picture_fields.bits.is_first_field = v->fcm == 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
191 pic_param->picture_fields.bits.intensity_compensation = v->mv_mode == MV_PMODE_INTENSITY_COMP;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
192 pic_param->raw_coding.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
193 pic_param->raw_coding.flags.mv_type_mb = v->mv_type_is_raw;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
194 pic_param->raw_coding.flags.direct_mb = v->dmb_is_raw;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
195 pic_param->raw_coding.flags.skip_mb = v->skip_is_raw;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
196 pic_param->raw_coding.flags.field_tx = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
197 pic_param->raw_coding.flags.forward_mb = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
198 pic_param->raw_coding.flags.ac_pred = v->acpred_is_raw;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
199 pic_param->raw_coding.flags.overflags = v->overflg_is_raw;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
200 pic_param->bitplane_present.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
201 pic_param->bitplane_present.flags.bp_mv_type_mb = vc1_has_MVTYPEMB_bitplane(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
202 pic_param->bitplane_present.flags.bp_direct_mb = vc1_has_DIRECTMB_bitplane(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
203 pic_param->bitplane_present.flags.bp_skip_mb = vc1_has_SKIPMB_bitplane(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
204 pic_param->bitplane_present.flags.bp_field_tx = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
205 pic_param->bitplane_present.flags.bp_forward_mb = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
206 pic_param->bitplane_present.flags.bp_ac_pred = vc1_has_ACPRED_bitplane(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
207 pic_param->bitplane_present.flags.bp_overflags = vc1_has_OVERFLAGS_bitplane(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
208 pic_param->reference_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
209 pic_param->reference_fields.bits.reference_distance_flag = v->refdist_flag;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
210 pic_param->reference_fields.bits.reference_distance = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
211 pic_param->reference_fields.bits.num_reference_pictures = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
212 pic_param->reference_fields.bits.reference_field_pic_indicator = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
213 pic_param->mv_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
214 pic_param->mv_fields.bits.mv_mode = vc1_get_MVMODE(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
215 pic_param->mv_fields.bits.mv_mode2 = vc1_get_MVMODE2(v);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
216 pic_param->mv_fields.bits.mv_table = s->mv_table_index;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
217 pic_param->mv_fields.bits.two_mv_block_pattern_table = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
218 pic_param->mv_fields.bits.four_mv_switch = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
219 pic_param->mv_fields.bits.four_mv_block_pattern_table = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
220 pic_param->mv_fields.bits.extended_mv_flag = v->extended_mv;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
221 pic_param->mv_fields.bits.extended_mv_range = v->mvrange;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
222 pic_param->mv_fields.bits.extended_dmv_flag = v->extended_dmv;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
223 pic_param->mv_fields.bits.extended_dmv_range = 0; /* XXX: interlaced frame */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
224 pic_param->pic_quantizer_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
225 pic_param->pic_quantizer_fields.bits.dquant = v->dquant;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
226 pic_param->pic_quantizer_fields.bits.quantizer = v->quantizer_mode;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
227 pic_param->pic_quantizer_fields.bits.half_qp = v->halfpq;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
228 pic_param->pic_quantizer_fields.bits.pic_quantizer_scale = v->pq;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
229 pic_param->pic_quantizer_fields.bits.pic_quantizer_type = v->pquantizer;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
230 pic_param->pic_quantizer_fields.bits.dq_frame = v->dquantfrm;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
231 pic_param->pic_quantizer_fields.bits.dq_profile = v->dqprofile;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
232 pic_param->pic_quantizer_fields.bits.dq_sb_edge = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
233 pic_param->pic_quantizer_fields.bits.dq_db_edge = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
234 pic_param->pic_quantizer_fields.bits.dq_binary_level = v->dqbilevel;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
235 pic_param->pic_quantizer_fields.bits.alt_pic_quantizer = v->altpq;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
236 pic_param->transform_fields.value = 0; /* reset all bits */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
237 pic_param->transform_fields.bits.variable_sized_transform_flag = v->vstransform;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
238 pic_param->transform_fields.bits.mb_level_transform_type_flag = v->ttmbf;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
239 pic_param->transform_fields.bits.frame_level_transform_type = v->ttfrm;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
240 pic_param->transform_fields.bits.transform_ac_codingset_idx1 = v->c_ac_table_index;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
241 pic_param->transform_fields.bits.transform_ac_codingset_idx2 = v->y_ac_table_index;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
242 pic_param->transform_fields.bits.intra_transform_dc_table = v->s.dc_table_index;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
243
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
244 switch (s->pict_type) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
245 case FF_B_TYPE:
10723
3f08c340020f Rename ff_vaapi_get_surface() to ff_vaapi_get_surface_id().
gb
parents: 9993
diff changeset
246 pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
247 // fall-through
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
248 case FF_P_TYPE:
10723
3f08c340020f Rename ff_vaapi_get_surface() to ff_vaapi_get_surface_id().
gb
parents: 9993
diff changeset
249 pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture);
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
250 break;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
251 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
252
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
253 if (pic_param->bitplane_present.value) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
254 uint8_t *bitplane;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
255 const uint8_t *ff_bp[3];
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
256 int x, y, n;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
257
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
258 switch (s->pict_type) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
259 case FF_P_TYPE:
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
260 ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
261 ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
262 ff_bp[2] = pic_param->bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
263 break;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
264 case FF_B_TYPE:
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
265 if (!v->bi_type) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
266 ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
267 ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
268 ff_bp[2] = NULL; /* XXX: interlaced frame (FORWARD plane) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
269 break;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
270 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
271 /* fall-through (BI-type) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
272 case FF_I_TYPE:
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
273 ff_bp[0] = NULL; /* XXX: interlaced frame (FIELDTX plane) */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
274 ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred ? v->acpred_plane : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
275 ff_bp[2] = pic_param->bitplane_present.flags.bp_overflags ? v->over_flags_plane : NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
276 break;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
277 default:
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
278 ff_bp[0] = NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
279 ff_bp[1] = NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
280 ff_bp[2] = NULL;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
281 break;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
282 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
283
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
284 bitplane = ff_vaapi_alloc_bitplane(vactx, (s->mb_width * s->mb_height + 1) / 2);
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
285 if (!bitplane)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
286 return -1;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
287
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
288 n = 0;
10767
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
289 for (y = 0; y < s->mb_height; y++)
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
290 for (x = 0; x < s->mb_width; x++, n++)
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
291 vc1_pack_bitplanes(bitplane, n, ff_bp, x, y, s->mb_stride);
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
292 if (n & 1) /* move last nibble to the high order */
1e0d87fc2818 VAAPI: fix WMV3 decoding of videos with an odd number of macroblocks per line.
gb
parents: 10725
diff changeset
293 bitplane[n/2] <<= 4;
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
294 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
295 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
296 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
297
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
298 static int vaapi_vc1_end_frame(AVCodecContext *avctx)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
299 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
300 VC1Context * const v = avctx->priv_data;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
301
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
302 return ff_vaapi_common_end_frame(&v->s);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
303 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
304
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
305 static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
306 {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
307 VC1Context * const v = avctx->priv_data;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
308 MpegEncContext * const s = &v->s;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
309 VASliceParameterBufferVC1 *slice_param;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
310
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
311 dprintf(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
312
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
313 /* Current bit buffer is beyond any marker for VC-1, so skip it */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
314 if (avctx->codec_id == CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
315 buffer += 4;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
316 size -= 4;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
317 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
318
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
319 /* Fill in VASliceParameterBufferVC1 */
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
320 slice_param = (VASliceParameterBufferVC1 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
321 if (!slice_param)
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
322 return -1;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
323 slice_param->macroblock_offset = get_bits_count(&s->gb);
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
324 slice_param->slice_vertical_position = s->mb_y;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
325 return 0;
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
326 }
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
327
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
328 #if CONFIG_WMV3_VAAPI_HWACCEL
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
329 AVHWAccel wmv3_vaapi_hwaccel = {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
330 .name = "wmv3_vaapi",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10767
diff changeset
331 .type = AVMEDIA_TYPE_VIDEO,
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
332 .id = CODEC_ID_WMV3,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
333 .pix_fmt = PIX_FMT_VAAPI_VLD,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
334 .capabilities = 0,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
335 .start_frame = vaapi_vc1_start_frame,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
336 .end_frame = vaapi_vc1_end_frame,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
337 .decode_slice = vaapi_vc1_decode_slice,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
338 .priv_data_size = 0,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
339 };
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
340 #endif
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
341
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
342 AVHWAccel vc1_vaapi_hwaccel = {
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
343 .name = "vc1_vaapi",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 10767
diff changeset
344 .type = AVMEDIA_TYPE_VIDEO,
9338
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
345 .id = CODEC_ID_VC1,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
346 .pix_fmt = PIX_FMT_VAAPI_VLD,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
347 .capabilities = 0,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
348 .start_frame = vaapi_vc1_start_frame,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
349 .end_frame = vaapi_vc1_end_frame,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
350 .decode_slice = vaapi_vc1_decode_slice,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
351 .priv_data_size = 0,
41b37c9c4ff7 Add VC-1 bitstream decoding through VA API.
gb
parents:
diff changeset
352 };