Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
520fb772
Commit
520fb772
authored
8 years ago
by
Mark Thompson
Browse files
Options
Downloads
Patches
Plain Diff
vaapi_vc1: Convert to use the new VAAPI hwaccel code
parent
102e13c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/vaapi_vc1.c
+206
-140
206 additions, 140 deletions
libavcodec/vaapi_vc1.c
with
206 additions
and
140 deletions
libavcodec/vaapi_vc1.c
+
206
−
140
View file @
520fb772
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include
"vaapi_internal.h"
#include
"internal.h"
#include
"internal.h"
#include
"vaapi_decode.h"
#include
"vc1.h"
#include
"vc1.h"
#include
"vc1data.h"
#include
"vc1data.h"
...
@@ -148,143 +148,165 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
...
@@ -148,143 +148,165 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
{
{
const
VC1Context
*
v
=
avctx
->
priv_data
;
const
VC1Context
*
v
=
avctx
->
priv_data
;
const
MpegEncContext
*
s
=
&
v
->
s
;
const
MpegEncContext
*
s
=
&
v
->
s
;
struct
vaapi_context
*
const
vactx
=
avctx
->
hwaccel_context
;
VAAPIDecodePicture
*
pic
=
s
->
current_picture_ptr
->
hwaccel_picture_private
;
VAPictureParameterBufferVC1
*
pic_param
;
VAPictureParameterBufferVC1
pic_param
;
int
err
;
vactx
->
slice_param_size
=
sizeof
(
VASliceParameterBufferVC1
);
pic
->
output_surface
=
ff_vaapi_get_surface_id
(
s
->
current_picture_ptr
->
f
);
/* Fill in VAPictureParameterBufferVC1 */
pic_param
=
ff_vaapi_alloc_pic_param
(
vactx
,
sizeof
(
VAPictureParameterBufferVC1
));
pic_param
=
(
VAPictureParameterBufferVC1
)
{
if
(
!
pic_param
)
.
forward_reference_picture
=
VA_INVALID_ID
,
return
-
1
;
.
backward_reference_picture
=
VA_INVALID_ID
,
pic_param
->
forward_reference_picture
=
VA_INVALID_ID
;
.
inloop_decoded_picture
=
VA_INVALID_ID
,
pic_param
->
backward_reference_picture
=
VA_INVALID_ID
;
.
sequence_fields
.
bits
=
{
pic_param
->
inloop_decoded_picture
=
VA_INVALID_ID
;
.
pulldown
=
v
->
broadcast
,
pic_param
->
sequence_fields
.
value
=
0
;
/* reset all bits */
.
interlace
=
v
->
interlace
,
pic_param
->
sequence_fields
.
bits
.
pulldown
=
v
->
broadcast
;
.
tfcntrflag
=
v
->
tfcntrflag
,
pic_param
->
sequence_fields
.
bits
.
interlace
=
v
->
interlace
;
.
finterpflag
=
v
->
finterpflag
,
pic_param
->
sequence_fields
.
bits
.
tfcntrflag
=
v
->
tfcntrflag
;
.
psf
=
v
->
psf
,
pic_param
->
sequence_fields
.
bits
.
finterpflag
=
v
->
finterpflag
;
.
multires
=
v
->
multires
,
pic_param
->
sequence_fields
.
bits
.
psf
=
v
->
psf
;
.
overlap
=
v
->
overlap
,
pic_param
->
sequence_fields
.
bits
.
multires
=
v
->
multires
;
.
syncmarker
=
v
->
resync_marker
,
pic_param
->
sequence_fields
.
bits
.
overlap
=
v
->
overlap
;
.
rangered
=
v
->
rangered
,
pic_param
->
sequence_fields
.
bits
.
syncmarker
=
v
->
resync_marker
;
.
max_b_frames
=
s
->
avctx
->
max_b_frames
,
pic_param
->
sequence_fields
.
bits
.
rangered
=
v
->
rangered
;
.
profile
=
v
->
profile
,
pic_param
->
sequence_fields
.
bits
.
max_b_frames
=
s
->
avctx
->
max_b_frames
;
},
pic_param
->
sequence_fields
.
bits
.
profile
=
v
->
profile
;
.
coded_width
=
s
->
avctx
->
coded_width
,
pic_param
->
coded_width
=
s
->
avctx
->
coded_width
;
.
coded_height
=
s
->
avctx
->
coded_height
,
pic_param
->
coded_height
=
s
->
avctx
->
coded_height
;
.
entrypoint_fields
.
bits
=
{
pic_param
->
entrypoint_fields
.
value
=
0
;
/* reset all bits */
.
broken_link
=
v
->
broken_link
,
pic_param
->
entrypoint_fields
.
bits
.
broken_link
=
v
->
broken_link
;
.
closed_entry
=
v
->
closed_entry
,
pic_param
->
entrypoint_fields
.
bits
.
closed_entry
=
v
->
closed_entry
;
.
panscan_flag
=
v
->
panscanflag
,
pic_param
->
entrypoint_fields
.
bits
.
panscan_flag
=
v
->
panscanflag
;
.
loopfilter
=
s
->
loop_filter
,
pic_param
->
entrypoint_fields
.
bits
.
loopfilter
=
s
->
loop_filter
;
},
pic_param
->
conditional_overlap_flag
=
v
->
condover
;
.
conditional_overlap_flag
=
v
->
condover
,
pic_param
->
fast_uvmc_flag
=
v
->
fastuvmc
;
.
fast_uvmc_flag
=
v
->
fastuvmc
,
pic_param
->
range_mapping_fields
.
value
=
0
;
/* reset all bits */
.
range_mapping_fields
.
bits
=
{
pic_param
->
range_mapping_fields
.
bits
.
luma_flag
=
v
->
range_mapy_flag
;
.
luma_flag
=
v
->
range_mapy_flag
,
pic_param
->
range_mapping_fields
.
bits
.
luma
=
v
->
range_mapy
;
.
luma
=
v
->
range_mapy
,
pic_param
->
range_mapping_fields
.
bits
.
chroma_flag
=
v
->
range_mapuv_flag
;
.
chroma_flag
=
v
->
range_mapuv_flag
,
pic_param
->
range_mapping_fields
.
bits
.
chroma
=
v
->
range_mapuv
;
.
chroma
=
v
->
range_mapuv
,
pic_param
->
b_picture_fraction
=
v
->
bfraction_lut_index
;
},
pic_param
->
cbp_table
=
v
->
cbpcy_vlc
?
v
->
cbpcy_vlc
-
ff_vc1_cbpcy_p_vlc
:
0
;
.
b_picture_fraction
=
v
->
bfraction_lut_index
,
pic_param
->
mb_mode_table
=
0
;
/* XXX: interlaced frame */
.
cbp_table
=
v
->
cbpcy_vlc
?
v
->
cbpcy_vlc
-
ff_vc1_cbpcy_p_vlc
:
0
,
pic_param
->
range_reduction_frame
=
v
->
rangeredfrm
;
.
mb_mode_table
=
0
,
/* XXX: interlaced frame */
pic_param
->
rounding_control
=
v
->
rnd
;
.
range_reduction_frame
=
v
->
rangeredfrm
,
pic_param
->
post_processing
=
v
->
postproc
;
.
rounding_control
=
v
->
rnd
,
pic_param
->
picture_resolution_index
=
v
->
respic
;
.
post_processing
=
v
->
postproc
,
pic_param
->
luma_scale
=
v
->
lumscale
;
.
picture_resolution_index
=
v
->
respic
,
pic_param
->
luma_shift
=
v
->
lumshift
;
.
luma_scale
=
v
->
lumscale
,
pic_param
->
picture_fields
.
value
=
0
;
/* reset all bits */
.
luma_shift
=
v
->
lumshift
,
pic_param
->
picture_fields
.
bits
.
picture_type
=
vc1_get_PTYPE
(
v
);
.
picture_fields
.
bits
=
{
pic_param
->
picture_fields
.
bits
.
frame_coding_mode
=
v
->
fcm
;
.
picture_type
=
vc1_get_PTYPE
(
v
),
pic_param
->
picture_fields
.
bits
.
top_field_first
=
v
->
tff
;
.
frame_coding_mode
=
v
->
fcm
,
pic_param
->
picture_fields
.
bits
.
is_first_field
=
v
->
fcm
==
0
;
/* XXX: interlaced frame */
.
top_field_first
=
v
->
tff
,
pic_param
->
picture_fields
.
bits
.
intensity_compensation
=
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
;
.
is_first_field
=
v
->
fcm
==
0
,
/* XXX: interlaced frame */
pic_param
->
raw_coding
.
value
=
0
;
/* reset all bits */
.
intensity_compensation
=
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
,
pic_param
->
raw_coding
.
flags
.
mv_type_mb
=
v
->
mv_type_is_raw
;
},
pic_param
->
raw_coding
.
flags
.
direct_mb
=
v
->
dmb_is_raw
;
.
raw_coding
.
flags
=
{
pic_param
->
raw_coding
.
flags
.
skip_mb
=
v
->
skip_is_raw
;
.
mv_type_mb
=
v
->
mv_type_is_raw
,
pic_param
->
raw_coding
.
flags
.
field_tx
=
0
;
/* XXX: interlaced frame */
.
direct_mb
=
v
->
dmb_is_raw
,
pic_param
->
raw_coding
.
flags
.
forward_mb
=
0
;
/* XXX: interlaced frame */
.
skip_mb
=
v
->
skip_is_raw
,
pic_param
->
raw_coding
.
flags
.
ac_pred
=
v
->
acpred_is_raw
;
.
field_tx
=
0
,
/* XXX: interlaced frame */
pic_param
->
raw_coding
.
flags
.
overflags
=
v
->
overflg_is_raw
;
.
forward_mb
=
0
,
/* XXX: interlaced frame */
pic_param
->
bitplane_present
.
value
=
0
;
/* reset all bits */
.
ac_pred
=
v
->
acpred_is_raw
,
pic_param
->
bitplane_present
.
flags
.
bp_mv_type_mb
=
vc1_has_MVTYPEMB_bitplane
(
v
);
.
overflags
=
v
->
overflg_is_raw
,
pic_param
->
bitplane_present
.
flags
.
bp_direct_mb
=
vc1_has_DIRECTMB_bitplane
(
v
);
},
pic_param
->
bitplane_present
.
flags
.
bp_skip_mb
=
vc1_has_SKIPMB_bitplane
(
v
);
.
bitplane_present
.
flags
=
{
pic_param
->
bitplane_present
.
flags
.
bp_field_tx
=
0
;
/* XXX: interlaced frame */
.
bp_mv_type_mb
=
vc1_has_MVTYPEMB_bitplane
(
v
),
pic_param
->
bitplane_present
.
flags
.
bp_forward_mb
=
0
;
/* XXX: interlaced frame */
.
bp_direct_mb
=
vc1_has_DIRECTMB_bitplane
(
v
),
pic_param
->
bitplane_present
.
flags
.
bp_ac_pred
=
vc1_has_ACPRED_bitplane
(
v
);
.
bp_skip_mb
=
vc1_has_SKIPMB_bitplane
(
v
),
pic_param
->
bitplane_present
.
flags
.
bp_overflags
=
vc1_has_OVERFLAGS_bitplane
(
v
);
.
bp_field_tx
=
0
,
/* XXX: interlaced frame */
pic_param
->
reference_fields
.
value
=
0
;
/* reset all bits */
.
bp_forward_mb
=
0
,
/* XXX: interlaced frame */
pic_param
->
reference_fields
.
bits
.
reference_distance_flag
=
v
->
refdist_flag
;
.
bp_ac_pred
=
vc1_has_ACPRED_bitplane
(
v
),
pic_param
->
reference_fields
.
bits
.
reference_distance
=
0
;
/* XXX: interlaced frame */
.
bp_overflags
=
vc1_has_OVERFLAGS_bitplane
(
v
),
pic_param
->
reference_fields
.
bits
.
num_reference_pictures
=
0
;
/* XXX: interlaced frame */
},
pic_param
->
reference_fields
.
bits
.
reference_field_pic_indicator
=
0
;
/* XXX: interlaced frame */
.
reference_fields
.
bits
=
{
pic_param
->
mv_fields
.
value
=
0
;
/* reset all bits */
.
reference_distance_flag
=
v
->
refdist_flag
,
pic_param
->
mv_fields
.
bits
.
mv_mode
=
vc1_get_MVMODE
(
v
);
.
reference_distance
=
0
,
/* XXX: interlaced frame */
pic_param
->
mv_fields
.
bits
.
mv_mode2
=
vc1_get_MVMODE2
(
v
);
.
num_reference_pictures
=
0
,
/* XXX: interlaced frame */
pic_param
->
mv_fields
.
bits
.
mv_table
=
s
->
mv_table_index
;
.
reference_field_pic_indicator
=
0
,
/* XXX: interlaced frame */
pic_param
->
mv_fields
.
bits
.
two_mv_block_pattern_table
=
0
;
/* XXX: interlaced frame */
},
pic_param
->
mv_fields
.
bits
.
four_mv_switch
=
0
;
/* XXX: interlaced frame */
.
mv_fields
.
bits
=
{
pic_param
->
mv_fields
.
bits
.
four_mv_block_pattern_table
=
0
;
/* XXX: interlaced frame */
.
mv_mode
=
vc1_get_MVMODE
(
v
),
pic_param
->
mv_fields
.
bits
.
extended_mv_flag
=
v
->
extended_mv
;
.
mv_mode2
=
vc1_get_MVMODE2
(
v
),
pic_param
->
mv_fields
.
bits
.
extended_mv_range
=
v
->
mvrange
;
.
mv_table
=
s
->
mv_table_index
,
pic_param
->
mv_fields
.
bits
.
extended_dmv_flag
=
v
->
extended_dmv
;
.
two_mv_block_pattern_table
=
0
,
/* XXX: interlaced frame */
pic_param
->
mv_fields
.
bits
.
extended_dmv_range
=
0
;
/* XXX: interlaced frame */
.
four_mv_switch
=
0
,
/* XXX: interlaced frame */
pic_param
->
pic_quantizer_fields
.
value
=
0
;
/* reset all bits */
.
four_mv_block_pattern_table
=
0
,
/* XXX: interlaced frame */
pic_param
->
pic_quantizer_fields
.
bits
.
dquant
=
v
->
dquant
;
.
extended_mv_flag
=
v
->
extended_mv
,
pic_param
->
pic_quantizer_fields
.
bits
.
quantizer
=
v
->
quantizer_mode
;
.
extended_mv_range
=
v
->
mvrange
,
pic_param
->
pic_quantizer_fields
.
bits
.
half_qp
=
v
->
halfpq
;
.
extended_dmv_flag
=
v
->
extended_dmv
,
pic_param
->
pic_quantizer_fields
.
bits
.
pic_quantizer_scale
=
v
->
pq
;
.
extended_dmv_range
=
0
,
/* XXX: interlaced frame */
pic_param
->
pic_quantizer_fields
.
bits
.
pic_quantizer_type
=
v
->
pquantizer
;
},
pic_param
->
pic_quantizer_fields
.
bits
.
dq_frame
=
v
->
dquantfrm
;
.
pic_quantizer_fields
.
bits
=
{
pic_param
->
pic_quantizer_fields
.
bits
.
dq_profile
=
v
->
dqprofile
;
.
dquant
=
v
->
dquant
,
pic_param
->
pic_quantizer_fields
.
bits
.
dq_sb_edge
=
v
->
dqprofile
==
DQPROFILE_SINGLE_EDGE
?
v
->
dqsbedge
:
0
;
.
quantizer
=
v
->
quantizer_mode
,
pic_param
->
pic_quantizer_fields
.
bits
.
dq_db_edge
=
v
->
dqprofile
==
DQPROFILE_DOUBLE_EDGES
?
v
->
dqsbedge
:
0
;
.
half_qp
=
v
->
halfpq
,
pic_param
->
pic_quantizer_fields
.
bits
.
dq_binary_level
=
v
->
dqbilevel
;
.
pic_quantizer_scale
=
v
->
pq
,
pic_param
->
pic_quantizer_fields
.
bits
.
alt_pic_quantizer
=
v
->
altpq
;
.
pic_quantizer_type
=
v
->
pquantizer
,
pic_param
->
transform_fields
.
value
=
0
;
/* reset all bits */
.
dq_frame
=
v
->
dquantfrm
,
pic_param
->
transform_fields
.
bits
.
variable_sized_transform_flag
=
v
->
vstransform
;
.
dq_profile
=
v
->
dqprofile
,
pic_param
->
transform_fields
.
bits
.
mb_level_transform_type_flag
=
v
->
ttmbf
;
.
dq_sb_edge
=
v
->
dqprofile
==
DQPROFILE_SINGLE_EDGE
?
v
->
dqsbedge
:
0
,
pic_param
->
transform_fields
.
bits
.
frame_level_transform_type
=
vc1_get_TTFRM
(
v
);
.
dq_db_edge
=
v
->
dqprofile
==
DQPROFILE_DOUBLE_EDGES
?
v
->
dqsbedge
:
0
,
pic_param
->
transform_fields
.
bits
.
transform_ac_codingset_idx1
=
v
->
c_ac_table_index
;
.
dq_binary_level
=
v
->
dqbilevel
,
pic_param
->
transform_fields
.
bits
.
transform_ac_codingset_idx2
=
v
->
y_ac_table_index
;
.
alt_pic_quantizer
=
v
->
altpq
,
pic_param
->
transform_fields
.
bits
.
intra_transform_dc_table
=
v
->
s
.
dc_table_index
;
},
.
transform_fields
.
bits
=
{
.
variable_sized_transform_flag
=
v
->
vstransform
,
.
mb_level_transform_type_flag
=
v
->
ttmbf
,
.
frame_level_transform_type
=
vc1_get_TTFRM
(
v
),
.
transform_ac_codingset_idx1
=
v
->
c_ac_table_index
,
.
transform_ac_codingset_idx2
=
v
->
y_ac_table_index
,
.
intra_transform_dc_table
=
v
->
s
.
dc_table_index
,
},
};
switch
(
s
->
pict_type
)
{
switch
(
s
->
pict_type
)
{
case
AV_PICTURE_TYPE_B
:
case
AV_PICTURE_TYPE_B
:
pic_param
->
backward_reference_picture
=
ff_vaapi_get_surface_id
(
s
->
next_picture
.
f
);
pic_param
.
backward_reference_picture
=
ff_vaapi_get_surface_id
(
s
->
next_picture
.
f
);
// fall-through
// fall-through
case
AV_PICTURE_TYPE_P
:
case
AV_PICTURE_TYPE_P
:
pic_param
->
forward_reference_picture
=
ff_vaapi_get_surface_id
(
s
->
last_picture
.
f
);
pic_param
.
forward_reference_picture
=
ff_vaapi_get_surface_id
(
s
->
last_picture
.
f
);
break
;
break
;
}
}
if
(
pic_param
->
bitplane_present
.
value
)
{
err
=
ff_vaapi_decode_make_param_buffer
(
avctx
,
pic
,
VAPictureParameterBufferType
,
&
pic_param
,
sizeof
(
pic_param
));
if
(
err
)
goto
fail
;
if
(
pic_param
.
bitplane_present
.
value
)
{
uint8_t
*
bitplane
;
uint8_t
*
bitplane
;
const
uint8_t
*
ff_bp
[
3
];
const
uint8_t
*
ff_bp
[
3
];
int
x
,
y
,
n
;
int
x
,
y
,
n
;
size_t
size
=
(
s
->
mb_width
*
s
->
mb_height
+
1
)
/
2
;
bitplane
=
av_mallocz
(
size
);
if
(
!
bitplane
)
{
err
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
switch
(
s
->
pict_type
)
{
switch
(
s
->
pict_type
)
{
case
AV_PICTURE_TYPE_P
:
case
AV_PICTURE_TYPE_P
:
ff_bp
[
0
]
=
pic_param
->
bitplane_present
.
flags
.
bp_direct_mb
?
v
->
direct_mb_plane
:
NULL
;
ff_bp
[
0
]
=
pic_param
.
bitplane_present
.
flags
.
bp_direct_mb
?
v
->
direct_mb_plane
:
NULL
;
ff_bp
[
1
]
=
pic_param
->
bitplane_present
.
flags
.
bp_skip_mb
?
s
->
mbskip_table
:
NULL
;
ff_bp
[
1
]
=
pic_param
.
bitplane_present
.
flags
.
bp_skip_mb
?
s
->
mbskip_table
:
NULL
;
ff_bp
[
2
]
=
pic_param
->
bitplane_present
.
flags
.
bp_mv_type_mb
?
v
->
mv_type_mb_plane
:
NULL
;
ff_bp
[
2
]
=
pic_param
.
bitplane_present
.
flags
.
bp_mv_type_mb
?
v
->
mv_type_mb_plane
:
NULL
;
break
;
break
;
case
AV_PICTURE_TYPE_B
:
case
AV_PICTURE_TYPE_B
:
if
(
!
v
->
bi_type
)
{
if
(
!
v
->
bi_type
)
{
ff_bp
[
0
]
=
pic_param
->
bitplane_present
.
flags
.
bp_direct_mb
?
v
->
direct_mb_plane
:
NULL
;
ff_bp
[
0
]
=
pic_param
.
bitplane_present
.
flags
.
bp_direct_mb
?
v
->
direct_mb_plane
:
NULL
;
ff_bp
[
1
]
=
pic_param
->
bitplane_present
.
flags
.
bp_skip_mb
?
s
->
mbskip_table
:
NULL
;
ff_bp
[
1
]
=
pic_param
.
bitplane_present
.
flags
.
bp_skip_mb
?
s
->
mbskip_table
:
NULL
;
ff_bp
[
2
]
=
NULL
;
/* XXX: interlaced frame (FORWARD plane) */
ff_bp
[
2
]
=
NULL
;
/* XXX: interlaced frame (FORWARD plane) */
break
;
break
;
}
}
/* fall-through (BI-type) */
/* fall-through (BI-type) */
case
AV_PICTURE_TYPE_I
:
case
AV_PICTURE_TYPE_I
:
ff_bp
[
0
]
=
NULL
;
/* XXX: interlaced frame (FIELDTX plane) */
ff_bp
[
0
]
=
NULL
;
/* XXX: interlaced frame (FIELDTX plane) */
ff_bp
[
1
]
=
pic_param
->
bitplane_present
.
flags
.
bp_ac_pred
?
v
->
acpred_plane
:
NULL
;
ff_bp
[
1
]
=
pic_param
.
bitplane_present
.
flags
.
bp_ac_pred
?
v
->
acpred_plane
:
NULL
;
ff_bp
[
2
]
=
pic_param
->
bitplane_present
.
flags
.
bp_overflags
?
v
->
over_flags_plane
:
NULL
;
ff_bp
[
2
]
=
pic_param
.
bitplane_present
.
flags
.
bp_overflags
?
v
->
over_flags_plane
:
NULL
;
break
;
break
;
default:
default:
ff_bp
[
0
]
=
NULL
;
ff_bp
[
0
]
=
NULL
;
...
@@ -293,25 +315,51 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
...
@@ -293,25 +315,51 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
break
;
break
;
}
}
bitplane
=
ff_vaapi_alloc_bitplane
(
vactx
,
(
s
->
mb_width
*
s
->
mb_height
+
1
)
/
2
);
if
(
!
bitplane
)
return
-
1
;
n
=
0
;
n
=
0
;
for
(
y
=
0
;
y
<
s
->
mb_height
;
y
++
)
for
(
y
=
0
;
y
<
s
->
mb_height
;
y
++
)
for
(
x
=
0
;
x
<
s
->
mb_width
;
x
++
,
n
++
)
for
(
x
=
0
;
x
<
s
->
mb_width
;
x
++
,
n
++
)
vc1_pack_bitplanes
(
bitplane
,
n
,
ff_bp
,
x
,
y
,
s
->
mb_stride
);
vc1_pack_bitplanes
(
bitplane
,
n
,
ff_bp
,
x
,
y
,
s
->
mb_stride
);
if
(
n
&
1
)
/* move last nibble to the high order */
if
(
n
&
1
)
/* move last nibble to the high order */
bitplane
[
n
/
2
]
<<=
4
;
bitplane
[
n
/
2
]
<<=
4
;
err
=
ff_vaapi_decode_make_param_buffer
(
avctx
,
pic
,
VABitPlaneBufferType
,
bitplane
,
size
);
av_free
(
bitplane
);
if
(
err
)
goto
fail
;
}
}
return
0
;
return
0
;
fail:
ff_vaapi_decode_cancel
(
avctx
,
pic
);
return
err
;
}
static
int
vaapi_vc1_end_frame
(
AVCodecContext
*
avctx
)
{
VC1Context
*
v
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
v
->
s
;
VAAPIDecodePicture
*
pic
=
s
->
current_picture_ptr
->
hwaccel_picture_private
;
int
ret
;
ret
=
ff_vaapi_decode_issue
(
avctx
,
pic
);
if
(
ret
<
0
)
goto
fail
;
ff_mpeg_draw_horiz_band
(
s
,
0
,
s
->
avctx
->
height
);
fail:
return
ret
;
}
}
static
int
vaapi_vc1_decode_slice
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buffer
,
uint32_t
size
)
static
int
vaapi_vc1_decode_slice
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buffer
,
uint32_t
size
)
{
{
const
VC1Context
*
v
=
avctx
->
priv_data
;
const
VC1Context
*
v
=
avctx
->
priv_data
;
const
MpegEncContext
*
s
=
&
v
->
s
;
const
MpegEncContext
*
s
=
&
v
->
s
;
VASliceParameterBufferVC1
*
slice_param
;
VAAPIDecodePicture
*
pic
=
s
->
current_picture_ptr
->
hwaccel_picture_private
;
VASliceParameterBufferVC1
slice_param
;
int
err
;
/* Current bit buffer is beyond any marker for VC-1, so skip it */
/* Current bit buffer is beyond any marker for VC-1, so skip it */
if
(
avctx
->
codec_id
==
AV_CODEC_ID_VC1
&&
IS_MARKER
(
AV_RB32
(
buffer
)))
{
if
(
avctx
->
codec_id
==
AV_CODEC_ID_VC1
&&
IS_MARKER
(
AV_RB32
(
buffer
)))
{
...
@@ -319,33 +367,51 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
...
@@ -319,33 +367,51 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
size
-=
4
;
size
-=
4
;
}
}
/* Fill in VASliceParameterBufferVC1 */
slice_param
=
(
VASliceParameterBufferVC1
)
{
slice_param
=
(
VASliceParameterBufferVC1
*
)
ff_vaapi_alloc_slice
(
avctx
->
hwaccel_context
,
buffer
,
size
);
.
slice_data_size
=
size
,
if
(
!
slice_param
)
.
slice_data_offset
=
0
,
return
-
1
;
.
slice_data_flag
=
VA_SLICE_DATA_FLAG_ALL
,
slice_param
->
macroblock_offset
=
get_bits_count
(
&
s
->
gb
);
.
macroblock_offset
=
get_bits_count
(
&
s
->
gb
),
slice_param
->
slice_vertical_position
=
s
->
mb_y
;
.
slice_vertical_position
=
s
->
mb_y
,
};
err
=
ff_vaapi_decode_make_slice_buffer
(
avctx
,
pic
,
&
slice_param
,
sizeof
(
slice_param
),
buffer
,
size
);
if
(
err
<
0
)
{
ff_vaapi_decode_cancel
(
avctx
,
pic
);
return
err
;
}
return
0
;
return
0
;
}
}
#if CONFIG_WMV3_VAAPI_HWACCEL
#if CONFIG_WMV3_VAAPI_HWACCEL
AVHWAccel
ff_wmv3_vaapi_hwaccel
=
{
AVHWAccel
ff_wmv3_vaapi_hwaccel
=
{
.
name
=
"wmv3_vaapi"
,
.
name
=
"wmv3_vaapi"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_WMV3
,
.
id
=
AV_CODEC_ID_WMV3
,
.
pix_fmt
=
AV_PIX_FMT_VAAPI
,
.
pix_fmt
=
AV_PIX_FMT_VAAPI
,
.
start_frame
=
vaapi_vc1_start_frame
,
.
start_frame
=
&
vaapi_vc1_start_frame
,
.
end_frame
=
ff_vaapi_mpeg_end_frame
,
.
end_frame
=
&
vaapi_vc1_end_frame
,
.
decode_slice
=
vaapi_vc1_decode_slice
,
.
decode_slice
=
&
vaapi_vc1_decode_slice
,
.
frame_priv_data_size
=
sizeof
(
VAAPIDecodePicture
),
.
init
=
&
ff_vaapi_decode_init
,
.
uninit
=
&
ff_vaapi_decode_uninit
,
.
priv_data_size
=
sizeof
(
VAAPIDecodeContext
),
};
};
#endif
#endif
AVHWAccel
ff_vc1_vaapi_hwaccel
=
{
AVHWAccel
ff_vc1_vaapi_hwaccel
=
{
.
name
=
"vc1_vaapi"
,
.
name
=
"vc1_vaapi"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_VC1
,
.
id
=
AV_CODEC_ID_VC1
,
.
pix_fmt
=
AV_PIX_FMT_VAAPI
,
.
pix_fmt
=
AV_PIX_FMT_VAAPI
,
.
start_frame
=
vaapi_vc1_start_frame
,
.
start_frame
=
&
vaapi_vc1_start_frame
,
.
end_frame
=
ff_vaapi_mpeg_end_frame
,
.
end_frame
=
&
vaapi_vc1_end_frame
,
.
decode_slice
=
vaapi_vc1_decode_slice
,
.
decode_slice
=
&
vaapi_vc1_decode_slice
,
.
frame_priv_data_size
=
sizeof
(
VAAPIDecodePicture
),
.
init
=
&
ff_vaapi_decode_init
,
.
uninit
=
&
ff_vaapi_decode_uninit
,
.
priv_data_size
=
sizeof
(
VAAPIDecodeContext
),
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment