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
012c4511
Commit
012c4511
authored
Apr 07, 2016
by
Alexandra Hájková
Committed by
Anton Khirnov
Nov 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcm: Convert to the new bitstream header
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
ed006ae4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
adpcm.c
libavcodec/adpcm.c
+11
-9
No files found.
libavcodec/adpcm.c
View file @
012c4511
...
@@ -29,8 +29,9 @@
...
@@ -29,8 +29,9 @@
* License along with Libav; if not, write to the Free Software
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "avcodec.h"
#include "avcodec.h"
#include "
get_bits
.h"
#include "
bitstream
.h"
#include "put_bits.h"
#include "put_bits.h"
#include "bytestream.h"
#include "bytestream.h"
#include "adpcm.h"
#include "adpcm.h"
...
@@ -366,32 +367,33 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
...
@@ -366,32 +367,33 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
static
void
adpcm_swf_decode
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
,
int16_t
*
samples
)
static
void
adpcm_swf_decode
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
,
int16_t
*
samples
)
{
{
ADPCMDecodeContext
*
c
=
avctx
->
priv_data
;
ADPCMDecodeContext
*
c
=
avctx
->
priv_data
;
GetBitContext
gb
;
BitstreamContext
bc
;
const
int
*
table
;
const
int
*
table
;
int
k0
,
signmask
,
nb_bits
,
count
;
int
k0
,
signmask
,
nb_bits
,
count
;
int
size
=
buf_size
*
8
;
int
size
=
buf_size
*
8
;
int
i
;
int
i
;
init_get_bits
(
&
gb
,
buf
,
size
);
bitstream_init
(
&
bc
,
buf
,
size
);
//read bits & initial values
//read bits & initial values
nb_bits
=
get_bits
(
&
gb
,
2
)
+
2
;
nb_bits
=
bitstream_read
(
&
bc
,
2
)
+
2
;
table
=
swf_index_tables
[
nb_bits
-
2
];
table
=
swf_index_tables
[
nb_bits
-
2
];
k0
=
1
<<
(
nb_bits
-
2
);
k0
=
1
<<
(
nb_bits
-
2
);
signmask
=
1
<<
(
nb_bits
-
1
);
signmask
=
1
<<
(
nb_bits
-
1
);
while
(
get_bits_count
(
&
gb
)
<=
size
-
22
*
avctx
->
channels
)
{
while
(
bitstream_tell
(
&
bc
)
<=
size
-
22
*
avctx
->
channels
)
{
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
*
samples
++
=
c
->
status
[
i
].
predictor
=
get_sbits
(
&
gb
,
16
);
*
samples
++
=
c
->
status
[
i
].
step_index
=
get_bits
(
&
gb
,
6
);
c
->
status
[
i
].
predictor
=
bitstream_read_signed
(
&
bc
,
16
);
c
->
status
[
i
].
step_index
=
bitstream_read
(
&
bc
,
6
);
}
}
for
(
count
=
0
;
get_bits_count
(
&
gb
)
<=
size
-
nb_bits
*
avctx
->
channels
&&
count
<
4095
;
count
++
)
{
for
(
count
=
0
;
bitstream_tell
(
&
bc
)
<=
size
-
nb_bits
*
avctx
->
channels
&&
count
<
4095
;
count
++
)
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
// similar to IMA adpcm
// similar to IMA adpcm
int
delta
=
get_bits
(
&
gb
,
nb_bits
);
int
delta
=
bitstream_read
(
&
bc
,
nb_bits
);
int
step
=
ff_adpcm_step_table
[
c
->
status
[
i
].
step_index
];
int
step
=
ff_adpcm_step_table
[
c
->
status
[
i
].
step_index
];
long
vpdiff
=
0
;
// vpdiff = (delta+0.5)*step/4
long
vpdiff
=
0
;
// vpdiff = (delta+0.5)*step/4
int
k
=
k0
;
int
k
=
k0
;
...
...
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