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
e2e712e7
Commit
e2e712e7
authored
Mar 13, 2007
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10^10l to whoever wrote this
Originally committed as revision 8394 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
0c3c674c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
32 deletions
+4
-32
pcm.c
libavcodec/pcm.c
+4
-32
No files found.
libavcodec/pcm.c
View file @
e2e712e7
...
...
@@ -74,11 +74,8 @@ static int ulaw2linear(unsigned char u_val)
}
/* 16384 entries per table */
static
uint8_t
*
linear_to_alaw
=
NULL
;
static
int
linear_to_alaw_ref
=
0
;
static
uint8_t
*
linear_to_ulaw
=
NULL
;
static
int
linear_to_ulaw_ref
=
0
;
static
uint8_t
linear_to_alaw
[
16384
];
static
uint8_t
linear_to_ulaw
[
16384
];
static
void
build_xlaw_table
(
uint8_t
*
linear_to_xlaw
,
int
(
*
xlaw2linear
)(
unsigned
char
),
...
...
@@ -109,22 +106,10 @@ static int pcm_encode_init(AVCodecContext *avctx)
avctx
->
frame_size
=
1
;
switch
(
avctx
->
codec
->
id
)
{
case
CODEC_ID_PCM_ALAW
:
if
(
linear_to_alaw_ref
==
0
)
{
linear_to_alaw
=
av_malloc
(
16384
);
if
(
!
linear_to_alaw
)
return
-
1
;
build_xlaw_table
(
linear_to_alaw
,
alaw2linear
,
0xd5
);
}
linear_to_alaw_ref
++
;
build_xlaw_table
(
linear_to_alaw
,
alaw2linear
,
0xd5
);
break
;
case
CODEC_ID_PCM_MULAW
:
if
(
linear_to_ulaw_ref
==
0
)
{
linear_to_ulaw
=
av_malloc
(
16384
);
if
(
!
linear_to_ulaw
)
return
-
1
;
build_xlaw_table
(
linear_to_ulaw
,
ulaw2linear
,
0xff
);
}
linear_to_ulaw_ref
++
;
build_xlaw_table
(
linear_to_ulaw
,
ulaw2linear
,
0xff
);
break
;
default:
break
;
...
...
@@ -170,19 +155,6 @@ static int pcm_encode_close(AVCodecContext *avctx)
{
av_freep
(
&
avctx
->
coded_frame
);
switch
(
avctx
->
codec
->
id
)
{
case
CODEC_ID_PCM_ALAW
:
if
(
--
linear_to_alaw_ref
==
0
)
av_free
(
linear_to_alaw
);
break
;
case
CODEC_ID_PCM_MULAW
:
if
(
--
linear_to_ulaw_ref
==
0
)
av_free
(
linear_to_ulaw
);
break
;
default:
/* nothing to free */
break
;
}
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