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
1db6a080
Commit
1db6a080
authored
Mar 26, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dca: Move ff_dca_convert_bitstream() to the DCA common code
This makes the DCA parser and decoder independent.
parent
b2472539
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
75 deletions
+44
-75
Makefile
libavcodec/Makefile
+1
-1
dca.c
libavcodec/dca.c
+37
-0
dca.h
libavcodec/dca.h
+6
-0
dca_parser.c
libavcodec/dca_parser.c
+0
-37
dca_parser.h
libavcodec/dca_parser.h
+0
-36
dcadec.c
libavcodec/dcadec.c
+0
-1
No files found.
libavcodec/Makefile
View file @
1db6a080
...
...
@@ -134,7 +134,7 @@ OBJS-$(CONFIG_COMFORTNOISE_ENCODER) += cngenc.o
OBJS-$(CONFIG_CSCD_DECODER)
+=
cscd.o
OBJS-$(CONFIG_CYUV_DECODER)
+=
cyuv.o
OBJS-$(CONFIG_DCA_DECODER)
+=
dcadec.o
dca.o
dcadsp.o
\
dca_parser.o
synth_filter.o
synth_filter.o
OBJS-$(CONFIG_DFA_DECODER)
+=
dfa.o
OBJS-$(CONFIG_DNXHD_DECODER)
+=
dnxhddec.o
dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER)
+=
dnxhdenc.o
dnxhddata.o
...
...
libavcodec/dca.c
View file @
1db6a080
...
...
@@ -19,7 +19,9 @@
*/
#include <stdint.h>
#include <string.h>
#include "put_bits.h"
#include "dca.h"
const
uint32_t
avpriv_dca_sample_rates
[
16
]
=
...
...
@@ -27,3 +29,38 @@ const uint32_t avpriv_dca_sample_rates[16] =
0
,
8000
,
16000
,
32000
,
0
,
0
,
11025
,
22050
,
44100
,
0
,
0
,
12000
,
24000
,
48000
,
96000
,
192000
};
int
ff_dca_convert_bitstream
(
const
uint8_t
*
src
,
int
src_size
,
uint8_t
*
dst
,
int
max_size
)
{
uint32_t
mrk
;
int
i
,
tmp
;
const
uint16_t
*
ssrc
=
(
const
uint16_t
*
)
src
;
uint16_t
*
sdst
=
(
uint16_t
*
)
dst
;
PutBitContext
pb
;
if
((
unsigned
)
src_size
>
(
unsigned
)
max_size
)
src_size
=
max_size
;
mrk
=
AV_RB32
(
src
);
switch
(
mrk
)
{
case
DCA_MARKER_RAW_BE
:
memcpy
(
dst
,
src
,
src_size
);
return
src_size
;
case
DCA_MARKER_RAW_LE
:
for
(
i
=
0
;
i
<
(
src_size
+
1
)
>>
1
;
i
++
)
*
sdst
++
=
av_bswap16
(
*
ssrc
++
);
return
src_size
;
case
DCA_MARKER_14B_BE
:
case
DCA_MARKER_14B_LE
:
init_put_bits
(
&
pb
,
dst
,
max_size
);
for
(
i
=
0
;
i
<
(
src_size
+
1
)
>>
1
;
i
++
,
src
+=
2
)
{
tmp
=
((
mrk
==
DCA_MARKER_14B_BE
)
?
AV_RB16
(
src
)
:
AV_RL16
(
src
))
&
0x3FFF
;
put_bits
(
&
pb
,
14
,
tmp
);
}
flush_put_bits
(
&
pb
);
return
(
put_bits_count
(
&
pb
)
+
7
)
>>
3
;
default:
return
AVERROR_INVALIDDATA
;
}
}
libavcodec/dca.h
View file @
1db6a080
...
...
@@ -39,4 +39,10 @@
extern
av_export
const
uint32_t
avpriv_dca_sample_rates
[
16
];
/**
* Convert bitstream to one representation based on sync marker
*/
int
ff_dca_convert_bitstream
(
const
uint8_t
*
src
,
int
src_size
,
uint8_t
*
dst
,
int
max_size
);
#endif
/* AVCODEC_DCA_H */
libavcodec/dca_parser.c
View file @
1db6a080
...
...
@@ -24,9 +24,7 @@
#include "parser.h"
#include "dca.h"
#include "dca_parser.h"
#include "get_bits.h"
#include "put_bits.h"
typedef
struct
DCAParseContext
{
ParseContext
pc
;
...
...
@@ -103,41 +101,6 @@ static av_cold int dca_parse_init(AVCodecParserContext * s)
return
0
;
}
int
ff_dca_convert_bitstream
(
const
uint8_t
*
src
,
int
src_size
,
uint8_t
*
dst
,
int
max_size
)
{
uint32_t
mrk
;
int
i
,
tmp
;
const
uint16_t
*
ssrc
=
(
const
uint16_t
*
)
src
;
uint16_t
*
sdst
=
(
uint16_t
*
)
dst
;
PutBitContext
pb
;
if
((
unsigned
)
src_size
>
(
unsigned
)
max_size
)
src_size
=
max_size
;
mrk
=
AV_RB32
(
src
);
switch
(
mrk
)
{
case
DCA_MARKER_RAW_BE
:
memcpy
(
dst
,
src
,
src_size
);
return
src_size
;
case
DCA_MARKER_RAW_LE
:
for
(
i
=
0
;
i
<
(
src_size
+
1
)
>>
1
;
i
++
)
*
sdst
++
=
av_bswap16
(
*
ssrc
++
);
return
src_size
;
case
DCA_MARKER_14B_BE
:
case
DCA_MARKER_14B_LE
:
init_put_bits
(
&
pb
,
dst
,
max_size
);
for
(
i
=
0
;
i
<
(
src_size
+
1
)
>>
1
;
i
++
,
src
+=
2
)
{
tmp
=
((
mrk
==
DCA_MARKER_14B_BE
)
?
AV_RB16
(
src
)
:
AV_RL16
(
src
))
&
0x3FFF
;
put_bits
(
&
pb
,
14
,
tmp
);
}
flush_put_bits
(
&
pb
);
return
(
put_bits_count
(
&
pb
)
+
7
)
>>
3
;
default:
return
AVERROR_INVALIDDATA
;
}
}
static
int
dca_parse_params
(
const
uint8_t
*
buf
,
int
buf_size
,
int
*
duration
,
int
*
sample_rate
)
{
...
...
libavcodec/dca_parser.h
deleted
100644 → 0
View file @
b2472539
/*
* DCA parser
* Copyright (C) 2004 Gildas Bazin
* Copyright (C) 2004 Benjamin Zores
* Copyright (C) 2006 Benjamin Larsson
* Copyright (C) 2007 Konstantin Shishkov
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_DCA_PARSER_H
#define AVCODEC_DCA_PARSER_H
#include <stdint.h>
/**
* Convert bitstream to one representation based on sync marker
*/
int
ff_dca_convert_bitstream
(
const
uint8_t
*
src
,
int
src_size
,
uint8_t
*
dst
,
int
max_size
);
#endif
/* AVCODEC_DCA_PARSER_H */
libavcodec/dcadec.c
View file @
1db6a080
...
...
@@ -40,7 +40,6 @@
#include "dcadata.h"
#include "dcahuff.h"
#include "dca.h"
#include "dca_parser.h"
#include "mathops.h"
#include "synth_filter.h"
#include "dcadsp.h"
...
...
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