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
95fb9e02
Commit
95fb9e02
authored
Sep 19, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: add pcm_f16le and pcm_f24le decoder
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
4cf96c56
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
1 deletion
+59
-1
Changelog
Changelog
+2
-0
Makefile
libavcodec/Makefile
+2
-0
allcodecs.c
libavcodec/allcodecs.c
+2
-0
avcodec.h
libavcodec/avcodec.h
+2
-0
codec_desc.c
libavcodec/codec_desc.c
+14
-0
pcm.c
libavcodec/pcm.c
+34
-0
utils.c
libavcodec/utils.c
+2
-0
version.h
libavcodec/version.h
+1
-1
No files found.
Changelog
View file @
95fb9e02
...
...
@@ -9,6 +9,8 @@ version <next>:
- Support for spherical videos
- configure now fails if autodetect-libraries are requested but not found
- PSD Decoder
- 16.8 floating point pcm decoder
- 24.0 floating point pcm decoder
version 3.2:
- libopenmpt demuxer
...
...
libavcodec/Makefile
View file @
95fb9e02
...
...
@@ -658,6 +658,8 @@ OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_ALAW_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_BLURAY_DECODER)
+=
pcm-bluray.o
OBJS-$(CONFIG_PCM_DVD_DECODER)
+=
pcm-dvd.o
OBJS-$(CONFIG_PCM_F16LE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_F24LE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_F32BE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_F32BE_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_F32LE_DECODER)
+=
pcm.o
...
...
libavcodec/allcodecs.c
View file @
95fb9e02
...
...
@@ -477,6 +477,8 @@ void avcodec_register_all(void)
REGISTER_ENCDEC
(
PCM_ALAW
,
pcm_alaw
);
REGISTER_DECODER
(
PCM_BLURAY
,
pcm_bluray
);
REGISTER_DECODER
(
PCM_DVD
,
pcm_dvd
);
REGISTER_DECODER
(
PCM_F16LE
,
pcm_f16le
);
REGISTER_DECODER
(
PCM_F24LE
,
pcm_f24le
);
REGISTER_ENCDEC
(
PCM_F32BE
,
pcm_f32be
);
REGISTER_ENCDEC
(
PCM_F32LE
,
pcm_f32le
);
REGISTER_ENCDEC
(
PCM_F64BE
,
pcm_f64be
);
...
...
libavcodec/avcodec.h
View file @
95fb9e02
...
...
@@ -449,6 +449,8 @@ enum AVCodecID {
AV_CODEC_ID_PCM_S64LE
=
0x10800
,
AV_CODEC_ID_PCM_S64BE
,
AV_CODEC_ID_PCM_F16LE
,
AV_CODEC_ID_PCM_F24LE
,
/* various ADPCM codecs */
AV_CODEC_ID_ADPCM_IMA_QT
=
0x11000
,
...
...
libavcodec/codec_desc.c
View file @
95fb9e02
...
...
@@ -1748,6 +1748,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM signed 20|24-bit big-endian"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_F16LE
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
name
=
"pcm_f16le"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM 16.8 floating point little-endian"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_F24LE
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
name
=
"pcm_f24le"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM 24.0 floating point little-endian"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_F32BE
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
...
...
libavcodec/pcm.c
View file @
95fb9e02
...
...
@@ -25,6 +25,7 @@
*/
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
...
...
@@ -225,6 +226,8 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
typedef
struct
PCMDecode
{
short
table
[
256
];
AVFloatDSPContext
*
fdsp
;
float
scale
;
}
PCMDecode
;
static
av_cold
int
pcm_decode_init
(
AVCodecContext
*
avctx
)
...
...
@@ -246,6 +249,13 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
256
;
i
++
)
s
->
table
[
i
]
=
ulaw2linear
(
i
);
break
;
case
AV_CODEC_ID_PCM_F16LE
:
case
AV_CODEC_ID_PCM_F24LE
:
s
->
scale
=
1
.
/
(
1
<<
(
avctx
->
bits_per_coded_sample
-
1
));
s
->
fdsp
=
avpriv_float_dsp_alloc
(
0
);
if
(
!
s
->
fdsp
)
return
AVERROR
(
ENOMEM
);
break
;
default:
break
;
}
...
...
@@ -258,6 +268,15 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
return
0
;
}
static
av_cold
int
pcm_decode_close
(
AVCodecContext
*
avctx
)
{
PCMDecode
*
s
=
avctx
->
priv_data
;
av_freep
(
&
s
->
fdsp
);
return
0
;
}
/**
* Read PCM samples macro
* @param size Data size of native machine format
...
...
@@ -400,6 +419,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
break
;
case
AV_CODEC_ID_PCM_S32LE
:
case
AV_CODEC_ID_PCM_F32LE
:
case
AV_CODEC_ID_PCM_F24LE
:
case
AV_CODEC_ID_PCM_F16LE
:
DECODE
(
32
,
le32
,
src
,
samples
,
n
,
0
,
0
)
break
;
case
AV_CODEC_ID_PCM_S32LE_PLANAR
:
...
...
@@ -433,6 +454,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
break
;
case
AV_CODEC_ID_PCM_F64LE
:
case
AV_CODEC_ID_PCM_F32LE
:
case
AV_CODEC_ID_PCM_F24LE
:
case
AV_CODEC_ID_PCM_F16LE
:
case
AV_CODEC_ID_PCM_S64LE
:
case
AV_CODEC_ID_PCM_S32LE
:
case
AV_CODEC_ID_PCM_S16LE
:
...
...
@@ -495,6 +518,14 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
return
-
1
;
}
if
(
avctx
->
codec_id
==
AV_CODEC_ID_PCM_F16LE
||
avctx
->
codec_id
==
AV_CODEC_ID_PCM_F24LE
)
{
s
->
fdsp
->
vector_fmul_scalar
((
float
*
)
frame
->
extended_data
[
0
],
(
const
float
*
)
frame
->
extended_data
[
0
],
s
->
scale
,
FFALIGN
(
frame
->
nb_samples
*
avctx
->
channels
,
4
));
emms_c
();
}
*
got_frame_ptr
=
1
;
return
buf_size
;
...
...
@@ -530,6 +561,7 @@ AVCodec ff_ ## name_ ## _decoder = { \
.id = AV_CODEC_ID_ ## id_, \
.priv_data_size = sizeof(PCMDecode), \
.init = pcm_decode_init, \
.close = pcm_decode_close, \
.decode = pcm_decode_frame, \
.capabilities = AV_CODEC_CAP_DR1, \
.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
...
...
@@ -549,6 +581,8 @@ AVCodec ff_ ## name_ ## _decoder = { \
/* Note: Do not forget to add new entries to the Makefile as well. */
PCM_CODEC
(
PCM_ALAW
,
AV_SAMPLE_FMT_S16
,
pcm_alaw
,
"PCM A-law / G.711 A-law"
);
PCM_DECODER
(
PCM_F16LE
,
AV_SAMPLE_FMT_FLT
,
pcm_f16le
,
"PCM 16.8 floating point little-endian"
);
PCM_DECODER
(
PCM_F24LE
,
AV_SAMPLE_FMT_FLT
,
pcm_f24le
,
"PCM 24.0 floating point little-endian"
);
PCM_CODEC
(
PCM_F32BE
,
AV_SAMPLE_FMT_FLT
,
pcm_f32be
,
"PCM 32-bit floating point big-endian"
);
PCM_CODEC
(
PCM_F32LE
,
AV_SAMPLE_FMT_FLT
,
pcm_f32le
,
"PCM 32-bit floating point little-endian"
);
PCM_CODEC
(
PCM_F64BE
,
AV_SAMPLE_FMT_DBL
,
pcm_f64be
,
"PCM 64-bit floating point big-endian"
);
...
...
libavcodec/utils.c
View file @
95fb9e02
...
...
@@ -3500,6 +3500,8 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
case
AV_CODEC_ID_PCM_U32LE
:
case
AV_CODEC_ID_PCM_F32BE
:
case
AV_CODEC_ID_PCM_F32LE
:
case
AV_CODEC_ID_PCM_F24LE
:
case
AV_CODEC_ID_PCM_F16LE
:
return
32
;
case
AV_CODEC_ID_PCM_F64BE
:
case
AV_CODEC_ID_PCM_F64LE
:
...
...
libavcodec/version.h
View file @
95fb9e02
...
...
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 6
8
#define LIBAVCODEC_VERSION_MINOR 6
9
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
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