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
01200f12
Commit
01200f12
authored
Oct 09, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alacdec: move some declarations to the top of the function
parent
c3a92412
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
25 deletions
+21
-25
alac.c
libavcodec/alac.c
+21
-25
No files found.
libavcodec/alac.c
View file @
01200f12
...
...
@@ -366,6 +366,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
int
isnotcompressed
;
uint8_t
interlacing_shift
;
uint8_t
interlacing_leftweight
;
int
i
,
ch
;
/* short-circuit null buffers */
if
(
!
inbuffer
||
!
input_buffer_size
)
...
...
@@ -425,51 +426,49 @@ static int alac_decode_frame(AVCodecContext *avctx,
int
prediction_type
[
MAX_CHANNELS
];
int
prediction_quantitization
[
MAX_CHANNELS
];
int
ricemodifier
[
MAX_CHANNELS
];
int
i
,
chan
;
interlacing_shift
=
get_bits
(
&
alac
->
gb
,
8
);
interlacing_leftweight
=
get_bits
(
&
alac
->
gb
,
8
);
for
(
ch
an
=
0
;
chan
<
channels
;
chan
++
)
{
prediction_type
[
ch
an
]
=
get_bits
(
&
alac
->
gb
,
4
);
prediction_quantitization
[
ch
an
]
=
get_bits
(
&
alac
->
gb
,
4
);
for
(
ch
=
0
;
ch
<
channels
;
ch
++
)
{
prediction_type
[
ch
]
=
get_bits
(
&
alac
->
gb
,
4
);
prediction_quantitization
[
ch
]
=
get_bits
(
&
alac
->
gb
,
4
);
ricemodifier
[
ch
an
]
=
get_bits
(
&
alac
->
gb
,
3
);
predictor_coef_num
[
ch
an
]
=
get_bits
(
&
alac
->
gb
,
5
);
ricemodifier
[
ch
]
=
get_bits
(
&
alac
->
gb
,
3
);
predictor_coef_num
[
ch
]
=
get_bits
(
&
alac
->
gb
,
5
);
/* read the predictor table */
for
(
i
=
0
;
i
<
predictor_coef_num
[
ch
an
];
i
++
)
predictor_coef_table
[
ch
an
][
i
]
=
(
int16_t
)
get_bits
(
&
alac
->
gb
,
16
);
for
(
i
=
0
;
i
<
predictor_coef_num
[
ch
];
i
++
)
predictor_coef_table
[
ch
][
i
]
=
(
int16_t
)
get_bits
(
&
alac
->
gb
,
16
);
}
if
(
alac
->
extra_bits
)
{
int
i
,
ch
;
for
(
i
=
0
;
i
<
outputsamples
;
i
++
)
{
for
(
ch
=
0
;
ch
<
channels
;
ch
++
)
alac
->
extra_bits_buffer
[
ch
][
i
]
=
get_bits
(
&
alac
->
gb
,
alac
->
extra_bits
);
}
}
for
(
ch
an
=
0
;
chan
<
channels
;
chan
++
)
{
for
(
ch
=
0
;
ch
<
channels
;
ch
++
)
{
bastardized_rice_decompress
(
alac
,
alac
->
predicterror_buffer
[
ch
an
],
alac
->
predicterror_buffer
[
ch
],
outputsamples
,
readsamplesize
,
alac
->
setinfo_rice_initialhistory
,
alac
->
setinfo_rice_kmodifier
,
ricemodifier
[
ch
an
]
*
alac
->
setinfo_rice_historymult
/
4
,
ricemodifier
[
ch
]
*
alac
->
setinfo_rice_historymult
/
4
,
(
1
<<
alac
->
setinfo_rice_kmodifier
)
-
1
);
if
(
prediction_type
[
ch
an
]
==
0
)
{
if
(
prediction_type
[
ch
]
==
0
)
{
/* adaptive fir */
predictor_decompress_fir_adapt
(
alac
->
predicterror_buffer
[
ch
an
],
alac
->
outputsamples_buffer
[
ch
an
],
predictor_decompress_fir_adapt
(
alac
->
predicterror_buffer
[
ch
],
alac
->
outputsamples_buffer
[
ch
],
outputsamples
,
readsamplesize
,
predictor_coef_table
[
ch
an
],
predictor_coef_num
[
ch
an
],
prediction_quantitization
[
ch
an
]);
predictor_coef_table
[
ch
],
predictor_coef_num
[
ch
],
prediction_quantitization
[
ch
]);
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"FIXME: unhandled prediction type: %i
\n
"
,
prediction_type
[
ch
an
]);
av_log
(
avctx
,
AV_LOG_ERROR
,
"FIXME: unhandled prediction type: %i
\n
"
,
prediction_type
[
ch
]);
/* I think the only other prediction type (or perhaps this is
* just a boolean?) runs adaptive fir twice.. like:
* predictor_decompress_fir_adapt(predictor_error, tempout, ...)
...
...
@@ -480,11 +479,10 @@ static int alac_decode_frame(AVCodecContext *avctx,
}
}
else
{
/* not compressed, easy case */
int
i
,
chan
;
for
(
i
=
0
;
i
<
outputsamples
;
i
++
)
{
for
(
ch
an
=
0
;
chan
<
channels
;
chan
++
)
{
alac
->
outputsamples_buffer
[
ch
an
][
i
]
=
get_sbits_long
(
&
alac
->
gb
,
alac
->
setinfo_sample_size
);
for
(
ch
=
0
;
ch
<
channels
;
ch
++
)
{
alac
->
outputsamples_buffer
[
ch
][
i
]
=
get_sbits_long
(
&
alac
->
gb
,
alac
->
setinfo_sample_size
);
}
}
alac
->
extra_bits
=
0
;
...
...
@@ -510,7 +508,6 @@ static int alac_decode_frame(AVCodecContext *avctx,
interleave_stereo_16
(
alac
->
outputsamples_buffer
,
outbuffer
,
outputsamples
);
}
else
{
int
i
;
for
(
i
=
0
;
i
<
outputsamples
;
i
++
)
{
((
int16_t
*
)
outbuffer
)[
i
]
=
alac
->
outputsamples_buffer
[
0
][
i
];
}
...
...
@@ -521,7 +518,6 @@ static int alac_decode_frame(AVCodecContext *avctx,
interleave_stereo_24
(
alac
->
outputsamples_buffer
,
outbuffer
,
outputsamples
);
}
else
{
int
i
;
for
(
i
=
0
;
i
<
outputsamples
;
i
++
)
((
int32_t
*
)
outbuffer
)[
i
]
=
alac
->
outputsamples_buffer
[
0
][
i
]
<<
8
;
}
...
...
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