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
19aa028d
Commit
19aa028d
authored
Aug 31, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10l (keyframes and context resets)
Originally committed as revision 3426 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
39c61bbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
snow.c
libavcodec/snow.c
+13
-10
No files found.
libavcodec/snow.c
View file @
19aa028d
...
...
@@ -400,6 +400,7 @@ typedef struct SnowContext{
uint8_t
header_state
[
32
];
uint8_t
block_state
[
128
+
32
*
128
];
int
keyframe
;
int
always_reset
;
int
version
;
int
spatial_decomposition_type
;
int
temporal_decomposition_type
;
...
...
@@ -1526,7 +1527,7 @@ static inline void decode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTE
static
void
reset_contexts
(
SnowContext
*
s
){
int
plane_index
,
level
,
orientation
;
for
(
plane_index
=
0
;
plane_index
<
2
;
plane_index
++
){
for
(
plane_index
=
0
;
plane_index
<
3
;
plane_index
++
){
for
(
level
=
0
;
level
<
s
->
spatial_decomposition_count
;
level
++
){
for
(
orientation
=
level
?
1
:
0
;
orientation
<
4
;
orientation
++
){
memset
(
s
->
plane
[
plane_index
].
band
[
level
][
orientation
].
state
,
0
,
sizeof
(
s
->
plane
[
plane_index
].
band
[
level
][
orientation
].
state
));
...
...
@@ -2261,10 +2262,14 @@ static void correlate(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int
static
void
encode_header
(
SnowContext
*
s
){
int
plane_index
,
level
,
orientation
;
uint8_t
kstate
[
32
]
=
{
0
};
put_cabac
(
&
s
->
c
,
s
->
header_state
,
s
->
keyframe
);
// state clearing stuff?
put_cabac
(
&
s
->
c
,
kstate
,
s
->
keyframe
);
if
(
s
->
keyframe
||
s
->
always_reset
)
reset_contexts
(
s
);
if
(
s
->
keyframe
){
put_symbol
(
&
s
->
c
,
s
->
header_state
,
s
->
version
,
0
);
put_cabac
(
&
s
->
c
,
s
->
header_state
,
s
->
always_reset
);
put_symbol
(
&
s
->
c
,
s
->
header_state
,
s
->
temporal_decomposition_type
,
0
);
put_symbol
(
&
s
->
c
,
s
->
header_state
,
s
->
temporal_decomposition_count
,
0
);
put_symbol
(
&
s
->
c
,
s
->
header_state
,
s
->
spatial_decomposition_count
,
0
);
...
...
@@ -2292,14 +2297,18 @@ static void encode_header(SnowContext *s){
static
int
decode_header
(
SnowContext
*
s
){
int
plane_index
,
level
,
orientation
;
uint8_t
kstate
[
32
]
=
{
0
};
s
->
keyframe
=
get_cabac
(
&
s
->
c
,
s
->
header_state
);
s
->
keyframe
=
get_cabac
(
&
s
->
c
,
kstate
);
if
(
s
->
keyframe
||
s
->
always_reset
)
reset_contexts
(
s
);
if
(
s
->
keyframe
){
s
->
version
=
get_symbol
(
&
s
->
c
,
s
->
header_state
,
0
);
if
(
s
->
version
>
0
){
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"version %d not supported"
,
s
->
version
);
return
-
1
;
}
s
->
always_reset
=
get_cabac
(
&
s
->
c
,
s
->
header_state
);
s
->
temporal_decomposition_type
=
get_symbol
(
&
s
->
c
,
s
->
header_state
,
0
);
s
->
temporal_decomposition_count
=
get_symbol
(
&
s
->
c
,
s
->
header_state
,
0
);
s
->
spatial_decomposition_count
=
get_symbol
(
&
s
->
c
,
s
->
header_state
,
0
);
...
...
@@ -2522,9 +2531,6 @@ static int frame_start(SnowContext *s){
int
w
=
s
->
avctx
->
width
;
//FIXME round up to x16 ?
int
h
=
s
->
avctx
->
height
;
if
(
s
->
keyframe
)
reset_contexts
(
s
);
if
(
s
->
current_picture
.
data
[
0
]){
draw_edges
(
s
->
current_picture
.
data
[
0
],
s
->
current_picture
.
linesize
[
0
],
w
,
h
,
EDGE_WIDTH
);
draw_edges
(
s
->
current_picture
.
data
[
1
],
s
->
current_picture
.
linesize
[
1
],
w
>>
1
,
h
>>
1
,
EDGE_WIDTH
/
2
);
...
...
@@ -2557,8 +2563,6 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
s
->
input_picture
=
*
pict
;
memset
(
s
->
header_state
,
0
,
sizeof
(
s
->
header_state
));
s
->
keyframe
=
avctx
->
gop_size
==
0
||
avctx
->
frame_number
%
avctx
->
gop_size
==
0
;
pict
->
pict_type
=
s
->
keyframe
?
FF_I_TYPE
:
FF_P_TYPE
;
...
...
@@ -2571,6 +2575,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
}
frame_start
(
s
);
s
->
current_picture
.
key_frame
=
s
->
keyframe
;
if
(
pict
->
pict_type
==
P_TYPE
){
int
block_width
=
(
width
+
15
)
>>
4
;
...
...
@@ -2777,8 +2782,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
ff_init_cabac_decoder
(
c
,
buf
,
buf_size
);
ff_init_cabac_states
(
c
,
ff_h264_lps_range
,
ff_h264_mps_state
,
ff_h264_lps_state
,
64
);
memset
(
s
->
header_state
,
0
,
sizeof
(
s
->
header_state
));
s
->
current_picture
.
pict_type
=
FF_I_TYPE
;
//FIXME I vs. P
decode_header
(
s
);
if
(
!
s
->
block
)
alloc_blocks
(
s
);
...
...
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