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
edbb0c07
Commit
edbb0c07
authored
Feb 05, 2011
by
Alexander Strange
Committed by
Ronald S. Bultje
Feb 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vp3: Move table allocation code into a new function
Signed-off-by:
Ronald S. Bultje
<
rsbultje@gmail.com
>
parent
e8dcd730
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
+33
-23
vp3.c
libavcodec/vp3.c
+33
-23
No files found.
libavcodec/vp3.c
View file @
edbb0c07
...
...
@@ -1511,6 +1511,38 @@ static void render_slice(Vp3DecodeContext *s, int slice)
vp3_draw_horiz_band
(
s
,
FFMIN
((
32
<<
s
->
chroma_y_shift
)
*
(
slice
+
1
)
-
16
,
s
->
height
-
16
));
}
/// Allocate tables for per-frame data in Vp3DecodeContext
static
av_cold
int
allocate_tables
(
AVCodecContext
*
avctx
)
{
Vp3DecodeContext
*
s
=
avctx
->
priv_data
;
int
y_fragment_count
,
c_fragment_count
;
y_fragment_count
=
s
->
fragment_width
[
0
]
*
s
->
fragment_height
[
0
];
c_fragment_count
=
s
->
fragment_width
[
1
]
*
s
->
fragment_height
[
1
];
s
->
superblock_coding
=
av_malloc
(
s
->
superblock_count
);
s
->
all_fragments
=
av_malloc
(
s
->
fragment_count
*
sizeof
(
Vp3Fragment
));
s
->
coded_fragment_list
[
0
]
=
av_malloc
(
s
->
fragment_count
*
sizeof
(
int
));
s
->
dct_tokens_base
=
av_malloc
(
64
*
s
->
fragment_count
*
sizeof
(
*
s
->
dct_tokens_base
));
s
->
motion_val
[
0
]
=
av_malloc
(
y_fragment_count
*
sizeof
(
*
s
->
motion_val
[
0
]));
s
->
motion_val
[
1
]
=
av_malloc
(
c_fragment_count
*
sizeof
(
*
s
->
motion_val
[
1
]));
/* work out the block mapping tables */
s
->
superblock_fragments
=
av_malloc
(
s
->
superblock_count
*
16
*
sizeof
(
int
));
s
->
macroblock_coding
=
av_malloc
(
s
->
macroblock_count
+
1
);
if
(
!
s
->
superblock_coding
||
!
s
->
all_fragments
||
!
s
->
dct_tokens_base
||
!
s
->
coded_fragment_list
[
0
]
||
!
s
->
superblock_fragments
||
!
s
->
macroblock_coding
||
!
s
->
motion_val
[
0
]
||
!
s
->
motion_val
[
1
])
{
vp3_decode_end
(
avctx
);
return
-
1
;
}
init_block_mapping
(
s
);
return
0
;
}
/*
* This is the ffmpeg/libavcodec API init function.
*/
...
...
@@ -1560,7 +1592,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
s
->
superblock_count
=
s
->
y_superblock_count
+
(
s
->
c_superblock_count
*
2
);
s
->
u_superblock_start
=
s
->
y_superblock_count
;
s
->
v_superblock_start
=
s
->
u_superblock_start
+
s
->
c_superblock_count
;
s
->
superblock_coding
=
av_malloc
(
s
->
superblock_count
);
s
->
macroblock_width
=
(
s
->
width
+
15
)
/
16
;
s
->
macroblock_height
=
(
s
->
height
+
15
)
/
16
;
...
...
@@ -1578,18 +1609,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
s
->
fragment_start
[
1
]
=
y_fragment_count
;
s
->
fragment_start
[
2
]
=
y_fragment_count
+
c_fragment_count
;
s
->
all_fragments
=
av_malloc
(
s
->
fragment_count
*
sizeof
(
Vp3Fragment
));
s
->
coded_fragment_list
[
0
]
=
av_malloc
(
s
->
fragment_count
*
sizeof
(
int
));
s
->
dct_tokens_base
=
av_malloc
(
64
*
s
->
fragment_count
*
sizeof
(
*
s
->
dct_tokens_base
));
s
->
motion_val
[
0
]
=
av_malloc
(
y_fragment_count
*
sizeof
(
*
s
->
motion_val
[
0
]));
s
->
motion_val
[
1
]
=
av_malloc
(
c_fragment_count
*
sizeof
(
*
s
->
motion_val
[
1
]));
if
(
!
s
->
superblock_coding
||
!
s
->
all_fragments
||
!
s
->
dct_tokens_base
||
!
s
->
coded_fragment_list
[
0
]
||
!
s
->
motion_val
[
0
]
||
!
s
->
motion_val
[
1
])
{
vp3_decode_end
(
avctx
);
return
-
1
;
}
if
(
!
s
->
theora_tables
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
...
...
@@ -1689,22 +1708,13 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
&
motion_vector_vlc_table
[
0
][
1
],
2
,
1
,
&
motion_vector_vlc_table
[
0
][
0
],
2
,
1
,
0
);
/* work out the block mapping tables */
s
->
superblock_fragments
=
av_malloc
(
s
->
superblock_count
*
16
*
sizeof
(
int
));
s
->
macroblock_coding
=
av_malloc
(
s
->
macroblock_count
+
1
);
if
(
!
s
->
superblock_fragments
||
!
s
->
macroblock_coding
)
{
vp3_decode_end
(
avctx
);
return
-
1
;
}
init_block_mapping
(
s
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
s
->
current_frame
.
data
[
i
]
=
NULL
;
s
->
last_frame
.
data
[
i
]
=
NULL
;
s
->
golden_frame
.
data
[
i
]
=
NULL
;
}
return
0
;
return
allocate_tables
(
avctx
)
;
vlc_fail:
av_log
(
avctx
,
AV_LOG_FATAL
,
"Invalid huffman table
\n
"
);
...
...
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