Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e1f90771
Commit
e1f90771
authored
Mar 23, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: factor out common code from init() and init_thread_copy()
parent
43fd3dd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
39 deletions
+43
-39
h264.c
libavcodec/h264.c
+43
-39
No files found.
libavcodec/h264.c
View file @
e1f90771
...
@@ -584,36 +584,31 @@ int ff_h264_decode_extradata(H264Context *h)
...
@@ -584,36 +584,31 @@ int ff_h264_decode_extradata(H264Context *h)
return
0
;
return
0
;
}
}
av_cold
int
ff_h264_decode_init
(
AVCodecContext
*
avctx
)
static
int
h264_init_context
(
AVCodecContext
*
avctx
,
H264Context
*
h
)
{
{
H264Context
*
h
=
avctx
->
priv_data
;
int
i
;
int
i
;
int
ret
;
h
->
avctx
=
avctx
;
h
->
dequant_coeff_pps
=
-
1
;
h
->
avctx
=
avctx
;
h
->
dequant_coeff_pps
=
-
1
;
h
->
cur_chroma_format_idc
=
-
1
;
h
->
cur_chroma_format_idc
=
-
1
;
memset
(
h
->
pps
.
scaling_matrix4
,
16
,
6
*
16
*
sizeof
(
uint8_t
));
h
->
picture_structure
=
PICT_FRAME
;
memset
(
h
->
pps
.
scaling_matrix8
,
16
,
2
*
64
*
sizeof
(
uint8_t
));
h
->
slice_context_count
=
1
;
h
->
workaround_bugs
=
avctx
->
workaround_bugs
;
h
->
flags
=
avctx
->
flags
;
h
->
prev_poc_msb
=
1
<<
16
;
h
->
x264_build
=
-
1
;
h
->
recovery_frame
=
-
1
;
h
->
frame_recovered
=
0
;
h
->
picture_structure
=
PICT_FRAME
;
h
->
outputed_poc
=
h
->
next_outputed_poc
=
INT_MIN
;
h
->
slice_context_count
=
1
;
for
(
i
=
0
;
i
<
MAX_DELAYED_PIC_COUNT
;
i
++
)
h
->
workaround_bugs
=
avctx
->
workaround_bugs
;
h
->
last_pocs
[
i
]
=
INT_MIN
;
h
->
flags
=
avctx
->
flags
;
/* set defaults */
ff_h264_reset_sei
(
h
);
// s->decode_mb = ff_h263_decode_mb;
if
(
!
avctx
->
has_b_frames
)
h
->
low_delay
=
1
;
avctx
->
chroma_sample_location
=
AVCHROMA_LOC_LEFT
;
avctx
->
chroma_sample_location
=
AVCHROMA_LOC_LEFT
;
ff_h264_decode_init_vlc
();
ff_init_cabac_states
();
h
->
nb_slice_ctx
=
(
avctx
->
active_thread_type
&
FF_THREAD_SLICE
)
?
H264_MAX_THREADS
:
1
;
h
->
nb_slice_ctx
=
(
avctx
->
active_thread_type
&
FF_THREAD_SLICE
)
?
H264_MAX_THREADS
:
1
;
h
->
slice_ctx
=
av_mallocz_array
(
h
->
nb_slice_ctx
,
sizeof
(
*
h
->
slice_ctx
));
h
->
slice_ctx
=
av_mallocz_array
(
h
->
nb_slice_ctx
,
sizeof
(
*
h
->
slice_ctx
));
if
(
!
h
->
slice_ctx
)
{
if
(
!
h
->
slice_ctx
)
{
...
@@ -624,14 +619,30 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
...
@@ -624,14 +619,30 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
h
->
nb_slice_ctx
;
i
++
)
for
(
i
=
0
;
i
<
h
->
nb_slice_ctx
;
i
++
)
h
->
slice_ctx
[
i
].
h264
=
h
;
h
->
slice_ctx
[
i
].
h264
=
h
;
h
->
outputed_poc
=
h
->
next_outputed_poc
=
INT_MIN
;
return
0
;
for
(
i
=
0
;
i
<
MAX_DELAYED_PIC_COUNT
;
i
++
)
}
h
->
last_pocs
[
i
]
=
INT_MIN
;
h
->
prev_poc_msb
=
1
<<
16
;
av_cold
int
ff_h264_decode_init
(
AVCodecContext
*
avctx
)
h
->
x264_build
=
-
1
;
{
ff_h264_reset_sei
(
h
);
H264Context
*
h
=
avctx
->
priv_data
;
h
->
recovery_frame
=
-
1
;
int
ret
;
h
->
frame_recovered
=
0
;
ret
=
h264_init_context
(
avctx
,
h
);
if
(
ret
<
0
)
return
ret
;
memset
(
h
->
pps
.
scaling_matrix4
,
16
,
6
*
16
*
sizeof
(
uint8_t
));
memset
(
h
->
pps
.
scaling_matrix8
,
16
,
2
*
64
*
sizeof
(
uint8_t
));
/* set defaults */
// s->decode_mb = ff_h263_decode_mb;
if
(
!
avctx
->
has_b_frames
)
h
->
low_delay
=
1
;
ff_h264_decode_init_vlc
();
ff_init_cabac_states
();
if
(
avctx
->
codec_id
==
AV_CODEC_ID_H264
)
{
if
(
avctx
->
codec_id
==
AV_CODEC_ID_H264
)
{
if
(
avctx
->
ticks_per_frame
==
1
)
if
(
avctx
->
ticks_per_frame
==
1
)
h
->
avctx
->
framerate
.
num
*=
2
;
h
->
avctx
->
framerate
.
num
*=
2
;
...
@@ -666,24 +677,17 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
...
@@ -666,24 +677,17 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
static
int
decode_init_thread_copy
(
AVCodecContext
*
avctx
)
static
int
decode_init_thread_copy
(
AVCodecContext
*
avctx
)
{
{
H264Context
*
h
=
avctx
->
priv_data
;
H264Context
*
h
=
avctx
->
priv_data
;
int
i
;
int
ret
;
if
(
!
avctx
->
internal
->
is_copy
)
if
(
!
avctx
->
internal
->
is_copy
)
return
0
;
return
0
;
memset
(
h
->
sps_buffers
,
0
,
sizeof
(
h
->
sps_buffers
));
memset
(
h
->
sps_buffers
,
0
,
sizeof
(
h
->
sps_buffers
));
memset
(
h
->
pps_buffers
,
0
,
sizeof
(
h
->
pps_buffers
));
memset
(
h
->
pps_buffers
,
0
,
sizeof
(
h
->
pps_buffers
));
h
->
nb_slice_ctx
=
(
avctx
->
active_thread_type
&
FF_THREAD_SLICE
)
?
H264_MAX_THREADS
:
1
;
ret
=
h264_init_context
(
avctx
,
h
);
h
->
slice_ctx
=
av_mallocz_array
(
h
->
nb_slice_ctx
,
sizeof
(
*
h
->
slice_ctx
));
if
(
ret
<
0
)
if
(
!
h
->
slice_ctx
)
{
return
ret
;
h
->
nb_slice_ctx
=
0
;
return
AVERROR
(
ENOMEM
);
}
for
(
i
=
0
;
i
<
h
->
nb_slice_ctx
;
i
++
)
h
->
slice_ctx
[
i
].
h264
=
h
;
h
->
avctx
=
avctx
;
h
->
context_initialized
=
0
;
h
->
context_initialized
=
0
;
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment