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
1b1bb2c4
Commit
1b1bb2c4
authored
May 22, 2015
by
Anton Khirnov
Committed by
Vittorio Giovara
May 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rl: Add error checking to ff_rl_init().
parent
324e50ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
rl.c
libavcodec/rl.c
+20
-6
rl.h
libavcodec/rl.h
+1
-1
No files found.
libavcodec/rl.c
View file @
1b1bb2c4
...
...
@@ -34,7 +34,7 @@ void ff_rl_free(RLTable *rl)
}
}
av_cold
void
ff_rl_init
(
RLTable
*
rl
,
av_cold
int
ff_rl_init
(
RLTable
*
rl
,
uint8_t
static_store
[
2
][
2
*
MAX_RUN
+
MAX_LEVEL
+
3
])
{
int8_t
max_level
[
MAX_RUN
+
1
],
max_run
[
MAX_LEVEL
+
1
];
...
...
@@ -43,7 +43,7 @@ av_cold void ff_rl_init(RLTable *rl,
/* If table is static, we can quit if rl->max_level[0] is not NULL */
if
(
static_store
&&
rl
->
max_level
[
0
])
return
;
return
0
;
/* compute max_level[], max_run[] and index_run[] */
for
(
last
=
0
;
last
<
2
;
last
++
)
{
...
...
@@ -70,20 +70,34 @@ av_cold void ff_rl_init(RLTable *rl,
}
if
(
static_store
)
rl
->
max_level
[
last
]
=
static_store
[
last
];
else
else
{
rl
->
max_level
[
last
]
=
av_malloc
(
MAX_RUN
+
1
);
if
(
!
rl
->
max_level
[
last
])
goto
fail
;
}
memcpy
(
rl
->
max_level
[
last
],
max_level
,
MAX_RUN
+
1
);
if
(
static_store
)
rl
->
max_run
[
last
]
=
static_store
[
last
]
+
MAX_RUN
+
1
;
else
else
{
rl
->
max_run
[
last
]
=
av_malloc
(
MAX_LEVEL
+
1
);
if
(
!
rl
->
max_run
[
last
])
goto
fail
;
}
memcpy
(
rl
->
max_run
[
last
],
max_run
,
MAX_LEVEL
+
1
);
if
(
static_store
)
rl
->
index_run
[
last
]
=
static_store
[
last
]
+
MAX_RUN
+
MAX_LEVEL
+
2
;
else
else
{
rl
->
index_run
[
last
]
=
av_malloc
(
MAX_RUN
+
1
);
if
(
!
rl
->
index_run
[
last
])
goto
fail
;
}
memcpy
(
rl
->
index_run
[
last
],
index_run
,
MAX_RUN
+
1
);
}
return
0
;
fail:
ff_rl_free
(
rl
);
return
AVERROR
(
ENOMEM
);
}
av_cold
void
ff_rl_init_vlc
(
RLTable
*
rl
)
...
...
libavcodec/rl.h
View file @
1b1bb2c4
...
...
@@ -53,7 +53,7 @@ typedef struct RLTable {
* @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold
* the level and run tables, if this is NULL av_malloc() will be used
*/
void
ff_rl_init
(
RLTable
*
rl
,
uint8_t
static_store
[
2
][
2
*
MAX_RUN
+
MAX_LEVEL
+
3
]);
int
ff_rl_init
(
RLTable
*
rl
,
uint8_t
static_store
[
2
][
2
*
MAX_RUN
+
MAX_LEVEL
+
3
]);
void
ff_rl_init_vlc
(
RLTable
*
rl
);
/**
...
...
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