Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
edd4c19a
Commit
edd4c19a
authored
Apr 09, 2016
by
Alexandra Hájková
Committed by
Anton Khirnov
Nov 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atrac3plus: Convert to the new bitstream reader
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
02721192
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
atrac3plus.c
libavcodec/atrac3plus.c
+0
-0
atrac3plus.h
libavcodec/atrac3plus.h
+4
-3
atrac3plusdec.c
libavcodec/atrac3plusdec.c
+8
-7
No files found.
libavcodec/atrac3plus.c
View file @
edd4c19a
This diff is collapsed.
Click to expand it.
libavcodec/atrac3plus.h
View file @
edd4c19a
...
@@ -31,10 +31,11 @@
...
@@ -31,10 +31,11 @@
#include <stdint.h>
#include <stdint.h>
#include "libavutil/float_dsp.h"
#include "libavutil/float_dsp.h"
#include "atrac.h"
#include "atrac.h"
#include "bitstream.h"
#include "avcodec.h"
#include "avcodec.h"
#include "fft.h"
#include "fft.h"
#include "get_bits.h"
/** Global unit sizes */
/** Global unit sizes */
#define ATRAC3P_SUBBANDS 16 ///< number of PQF subbands
#define ATRAC3P_SUBBANDS 16 ///< number of PQF subbands
...
@@ -163,13 +164,13 @@ void ff_atrac3p_init_vlcs(AVCodec *codec);
...
@@ -163,13 +164,13 @@ void ff_atrac3p_init_vlcs(AVCodec *codec);
/**
/**
* Decode bitstream data of a channel unit.
* Decode bitstream data of a channel unit.
*
*
* @param[in]
gb the GetBit
context
* @param[in]
bc the Bitstream
context
* @param[in,out] ctx ptr to the channel unit context
* @param[in,out] ctx ptr to the channel unit context
* @param[in] num_channels number of channels to process
* @param[in] num_channels number of channels to process
* @param[in] avctx ptr to the AVCodecContext
* @param[in] avctx ptr to the AVCodecContext
* @return result code: 0 = OK, otherwise - error code
* @return result code: 0 = OK, otherwise - error code
*/
*/
int
ff_atrac3p_decode_channel_unit
(
GetBitContext
*
gb
,
Atrac3pChanUnitCtx
*
ctx
,
int
ff_atrac3p_decode_channel_unit
(
BitstreamContext
*
bc
,
Atrac3pChanUnitCtx
*
ctx
,
int
num_channels
,
AVCodecContext
*
avctx
);
int
num_channels
,
AVCodecContext
*
avctx
);
/**
/**
...
...
libavcodec/atrac3plusdec.c
View file @
edd4c19a
...
@@ -39,14 +39,15 @@
...
@@ -39,14 +39,15 @@
#include "libavutil/channel_layout.h"
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "avcodec.h"
#include "
get_bits
.h"
#include "
bitstream
.h"
#include "internal.h"
#include "internal.h"
#include "atrac.h"
#include "atrac.h"
#include "atrac3plus.h"
#include "atrac3plus.h"
typedef
struct
ATRAC3PContext
{
typedef
struct
ATRAC3PContext
{
GetBitContext
gb
;
BitstreamContext
bc
;
AVFloatDSPContext
fdsp
;
AVFloatDSPContext
fdsp
;
DECLARE_ALIGNED
(
32
,
float
,
samples
)[
2
][
ATRAC3P_FRAME_SAMPLES
];
///< quantized MDCT spectrum
DECLARE_ALIGNED
(
32
,
float
,
samples
)[
2
][
ATRAC3P_FRAME_SAMPLES
];
///< quantized MDCT spectrum
...
@@ -334,16 +335,16 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -334,16 +335,16 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
return
ret
;
return
ret
;
}
}
if
((
ret
=
init_get_bits8
(
&
ctx
->
gb
,
avpkt
->
data
,
avpkt
->
size
))
<
0
)
if
((
ret
=
bitstream_init8
(
&
ctx
->
bc
,
avpkt
->
data
,
avpkt
->
size
))
<
0
)
return
ret
;
return
ret
;
if
(
get_bits1
(
&
ctx
->
gb
))
{
if
(
bitstream_read_bit
(
&
ctx
->
bc
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid start bit!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid start bit!
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
while
(
get_bits_left
(
&
ctx
->
gb
)
>=
2
&&
while
(
bitstream_bits_left
(
&
ctx
->
bc
)
>=
2
&&
(
ch_unit_id
=
get_bits
(
&
ctx
->
gb
,
2
))
!=
CH_UNIT_TERMINATOR
)
{
(
ch_unit_id
=
bitstream_read
(
&
ctx
->
bc
,
2
))
!=
CH_UNIT_TERMINATOR
)
{
if
(
ch_unit_id
==
CH_UNIT_EXTENSION
)
{
if
(
ch_unit_id
==
CH_UNIT_EXTENSION
)
{
avpriv_report_missing_feature
(
avctx
,
"Channel unit extension"
);
avpriv_report_missing_feature
(
avctx
,
"Channel unit extension"
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
...
@@ -358,7 +359,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -358,7 +359,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
ctx
->
ch_units
[
ch_block
].
unit_type
=
ch_unit_id
;
ctx
->
ch_units
[
ch_block
].
unit_type
=
ch_unit_id
;
channels_to_process
=
ch_unit_id
+
1
;
channels_to_process
=
ch_unit_id
+
1
;
if
((
ret
=
ff_atrac3p_decode_channel_unit
(
&
ctx
->
gb
,
if
((
ret
=
ff_atrac3p_decode_channel_unit
(
&
ctx
->
bc
,
&
ctx
->
ch_units
[
ch_block
],
&
ctx
->
ch_units
[
ch_block
],
channels_to_process
,
channels_to_process
,
avctx
))
<
0
)
avctx
))
<
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