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
5a2f421a
Commit
5a2f421a
authored
May 09, 2007
by
Ramiro Polla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bytestream
Originally committed as revision 8964 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
a32c2ce4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
27 deletions
+11
-27
pcm.c
libavcodec/pcm.c
+11
-27
No files found.
libavcodec/pcm.c
View file @
5a2f421a
...
...
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "bitstream.h" // for ff_reverse
#include "bytestream.h"
/* from g711.c by SUN microsystems (unrestricted use) */
...
...
@@ -248,46 +249,34 @@ static int pcm_encode_frame(AVCodecContext *avctx,
uint32_t
tmp
=
ff_reverse
[
*
samples
>>
8
]
+
(
ff_reverse
[
*
samples
&
0xff
]
<<
8
);
tmp
<<=
4
;
// sync flags would go here
dst
[
2
]
=
tmp
&
0xff
;
tmp
>>=
8
;
dst
[
1
]
=
tmp
&
0xff
;
dst
[
0
]
=
tmp
>>
8
;
bytestream_put_be24
(
&
dst
,
tmp
);
samples
++
;
dst
+=
3
;
}
break
;
case
CODEC_ID_PCM_S16LE
:
for
(;
n
>
0
;
n
--
)
{
v
=
*
samples
++
;
dst
[
0
]
=
v
&
0xff
;
dst
[
1
]
=
v
>>
8
;
dst
+=
2
;
bytestream_put_le16
(
&
dst
,
v
);
}
break
;
case
CODEC_ID_PCM_S16BE
:
for
(;
n
>
0
;
n
--
)
{
v
=
*
samples
++
;
dst
[
0
]
=
v
>>
8
;
dst
[
1
]
=
v
;
dst
+=
2
;
bytestream_put_be16
(
&
dst
,
v
);
}
break
;
case
CODEC_ID_PCM_U16LE
:
for
(;
n
>
0
;
n
--
)
{
v
=
*
samples
++
;
v
+=
0x8000
;
dst
[
0
]
=
v
&
0xff
;
dst
[
1
]
=
v
>>
8
;
dst
+=
2
;
bytestream_put_le16
(
&
dst
,
v
);
}
break
;
case
CODEC_ID_PCM_U16BE
:
for
(;
n
>
0
;
n
--
)
{
v
=
*
samples
++
;
v
+=
0x8000
;
dst
[
0
]
=
v
>>
8
;
dst
[
1
]
=
v
;
dst
+=
2
;
bytestream_put_be16
(
&
dst
,
v
);
}
break
;
case
CODEC_ID_PCM_S8
:
...
...
@@ -425,39 +414,34 @@ static int pcm_decode_frame(AVCodecContext *avctx,
case
CODEC_ID_PCM_S24DAUD
:
n
=
buf_size
/
3
;
for
(;
n
>
0
;
n
--
)
{
uint32_t
v
=
src
[
0
]
<<
16
|
src
[
1
]
<<
8
|
src
[
2
]
;
uint32_t
v
=
bytestream_get_be24
(
&
src
)
;
v
>>=
4
;
// sync flags are here
*
samples
++
=
ff_reverse
[(
v
>>
8
)
&
0xff
]
+
(
ff_reverse
[
v
&
0xff
]
<<
8
);
src
+=
3
;
}
break
;
case
CODEC_ID_PCM_S16LE
:
n
=
buf_size
>>
1
;
for
(;
n
>
0
;
n
--
)
{
*
samples
++
=
src
[
0
]
|
(
src
[
1
]
<<
8
);
src
+=
2
;
*
samples
++
=
bytestream_get_le16
(
&
src
);
}
break
;
case
CODEC_ID_PCM_S16BE
:
n
=
buf_size
>>
1
;
for
(;
n
>
0
;
n
--
)
{
*
samples
++
=
(
src
[
0
]
<<
8
)
|
src
[
1
];
src
+=
2
;
*
samples
++
=
bytestream_get_be16
(
&
src
);
}
break
;
case
CODEC_ID_PCM_U16LE
:
n
=
buf_size
>>
1
;
for
(;
n
>
0
;
n
--
)
{
*
samples
++
=
(
src
[
0
]
|
(
src
[
1
]
<<
8
))
-
0x8000
;
src
+=
2
;
*
samples
++
=
bytestream_get_le16
(
&
src
)
-
0x8000
;
}
break
;
case
CODEC_ID_PCM_U16BE
:
n
=
buf_size
>>
1
;
for
(;
n
>
0
;
n
--
)
{
*
samples
++
=
((
src
[
0
]
<<
8
)
|
src
[
1
])
-
0x8000
;
src
+=
2
;
*
samples
++
=
bytestream_get_be16
(
&
src
)
-
0x8000
;
}
break
;
case
CODEC_ID_PCM_S8
:
...
...
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