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
467dfd5d
Commit
467dfd5d
authored
Nov 16, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PCM signed 24-bit/32-bit little-endian planar decoder
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
ee2d6fbc
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
13 deletions
+50
-13
general.texi
doc/general.texi
+3
-1
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
+22
-11
utils.c
libavcodec/utils.c
+2
-0
version.h
libavcodec/version.h
+1
-1
nut.c
libavformat/nut.c
+2
-0
No files found.
doc/general.texi
View file @
467dfd5d
...
...
@@ -826,7 +826,9 @@ following image formats are supported:
@tab supported through external library libopus
@item PCM A-law @tab X @tab X
@item PCM mu-law @tab X @tab X
@item PCM 16-bit little-endian planar @tab @tab X
@item PCM signed 16-bit little-endian planar @tab @tab X
@item PCM signed 24-bit little-endian planar @tab @tab X
@item PCM signed 32-bit little-endian planar @tab @tab X
@item PCM 32-bit floating point big-endian @tab X @tab X
@item PCM 32-bit floating point little-endian @tab X @tab X
@item PCM 64-bit floating point big-endian @tab X @tab X
...
...
libavcodec/Makefile
View file @
467dfd5d
...
...
@@ -533,10 +533,12 @@ OBJS-$(CONFIG_PCM_S24DAUD_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_S24DAUD_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S24LE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S24LE_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S24LE_PLANAR_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S32BE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S32BE_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S32LE_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S32LE_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_S32LE_PLANAR_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_U8_DECODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_U8_ENCODER)
+=
pcm.o
OBJS-$(CONFIG_PCM_U16BE_DECODER)
+=
pcm.o
...
...
libavcodec/allcodecs.c
View file @
467dfd5d
...
...
@@ -363,8 +363,10 @@ void avcodec_register_all(void)
REGISTER_ENCDEC
(
PCM_S24BE
,
pcm_s24be
);
REGISTER_ENCDEC
(
PCM_S24DAUD
,
pcm_s24daud
);
REGISTER_ENCDEC
(
PCM_S24LE
,
pcm_s24le
);
REGISTER_DECODER
(
PCM_S24LE_PLANAR
,
pcm_s24le_planar
);
REGISTER_ENCDEC
(
PCM_S32BE
,
pcm_s32be
);
REGISTER_ENCDEC
(
PCM_S32LE
,
pcm_s32le
);
REGISTER_DECODER
(
PCM_S32LE_PLANAR
,
pcm_s32le_planar
);
REGISTER_ENCDEC
(
PCM_U8
,
pcm_u8
);
REGISTER_ENCDEC
(
PCM_U16BE
,
pcm_u16be
);
REGISTER_ENCDEC
(
PCM_U16LE
,
pcm_u16le
);
...
...
libavcodec/avcodec.h
View file @
467dfd5d
...
...
@@ -315,6 +315,8 @@ enum AVCodecID {
AV_CODEC_ID_PCM_LXF
,
AV_CODEC_ID_S302M
,
AV_CODEC_ID_PCM_S8_PLANAR
,
AV_CODEC_ID_PCM_S24LE_PLANAR
=
MKBETAG
(
24
,
'P'
,
'S'
,
'P'
),
AV_CODEC_ID_PCM_S32LE_PLANAR
=
MKBETAG
(
32
,
'P'
,
'S'
,
'P'
),
/* various ADPCM codecs */
AV_CODEC_ID_ADPCM_IMA_QT
=
0x11000
,
...
...
libavcodec/codec_desc.c
View file @
467dfd5d
...
...
@@ -1454,6 +1454,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM signed 16-bit little-endian planar"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_S24LE_PLANAR
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
name
=
"pcm_s24le_planar"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM signed 24-bit little-endian planar"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_S32LE_PLANAR
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
name
=
"pcm_s32le_planar"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PCM signed 32-bit little-endian planar"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
{
.
id
=
AV_CODEC_ID_PCM_DVD
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
...
...
libavcodec/pcm.c
View file @
467dfd5d
...
...
@@ -252,6 +252,19 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
dst += size / 8; \
}
#define DECODE_PLANAR(size, endian, src, dst, n, shift, offset) { \
int i; \
n /= avctx->channels; \
for (c = 0; c < avctx->channels; c++) { \
dst = s->frame.extended_data[c]; \
for (i = n; i > 0; i--) { \
uint ## size ## _t v = bytestream_get_ ## endian(&src); \
AV_WN ## size ## A(dst, (v - offset) << shift); \
dst += size / 8; \
} \
} \
}
static
int
pcm_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
...
...
@@ -344,18 +357,14 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
}
break
;
case
AV_CODEC_ID_PCM_S16LE_PLANAR
:
{
int
i
;
n
/=
avctx
->
channels
;
for
(
c
=
0
;
c
<
avctx
->
channels
;
c
++
)
{
samples
=
s
->
frame
.
extended_data
[
c
];
for
(
i
=
n
;
i
>
0
;
i
--
)
{
AV_WN16A
(
samples
,
bytestream_get_le16
(
&
src
));
samples
+=
2
;
}
}
DECODE_PLANAR
(
16
,
le16
,
src
,
samples
,
n
,
0
,
0
);
break
;
case
AV_CODEC_ID_PCM_S24LE_PLANAR
:
DECODE_PLANAR
(
32
,
le24
,
src
,
samples
,
n
,
8
,
0
);
break
;
case
AV_CODEC_ID_PCM_S32LE_PLANAR
:
DECODE_PLANAR
(
32
,
le32
,
src
,
samples
,
n
,
0
,
0
);
break
;
}
case
AV_CODEC_ID_PCM_U16LE
:
DECODE
(
16
,
le16
,
src
,
samples
,
n
,
0
,
0x8000
)
break
;
...
...
@@ -544,8 +553,10 @@ PCM_DECODER(PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM signed 1
PCM_CODEC
(
PCM_S24BE
,
AV_SAMPLE_FMT_S32
,
pcm_s24be
,
"PCM signed 24-bit big-endian"
);
PCM_CODEC
(
PCM_S24DAUD
,
AV_SAMPLE_FMT_S16
,
pcm_s24daud
,
"PCM D-Cinema audio signed 24-bit"
);
PCM_CODEC
(
PCM_S24LE
,
AV_SAMPLE_FMT_S32
,
pcm_s24le
,
"PCM signed 24-bit little-endian"
);
PCM_DECODER
(
PCM_S24LE_PLANAR
,
AV_SAMPLE_FMT_S32P
,
pcm_s24le_planar
,
"PCM signed 24-bit little-endian planar"
);
PCM_CODEC
(
PCM_S32BE
,
AV_SAMPLE_FMT_S32
,
pcm_s32be
,
"PCM signed 32-bit big-endian"
);
PCM_CODEC
(
PCM_S32LE
,
AV_SAMPLE_FMT_S32
,
pcm_s32le
,
"PCM signed 32-bit little-endian"
);
PCM_DECODER
(
PCM_S32LE_PLANAR
,
AV_SAMPLE_FMT_S32P
,
pcm_s32le_planar
,
"PCM signed 32-bit little-endian planar"
);
PCM_CODEC
(
PCM_U8
,
AV_SAMPLE_FMT_U8
,
pcm_u8
,
"PCM unsigned 8-bit"
);
PCM_CODEC
(
PCM_U16BE
,
AV_SAMPLE_FMT_S16
,
pcm_u16be
,
"PCM unsigned 16-bit big-endian"
);
PCM_CODEC
(
PCM_U16LE
,
AV_SAMPLE_FMT_S16
,
pcm_u16le
,
"PCM unsigned 16-bit little-endian"
);
...
...
libavcodec/utils.c
View file @
467dfd5d
...
...
@@ -2319,11 +2319,13 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
case
AV_CODEC_ID_PCM_S24DAUD
:
case
AV_CODEC_ID_PCM_S24BE
:
case
AV_CODEC_ID_PCM_S24LE
:
case
AV_CODEC_ID_PCM_S24LE_PLANAR
:
case
AV_CODEC_ID_PCM_U24BE
:
case
AV_CODEC_ID_PCM_U24LE
:
return
24
;
case
AV_CODEC_ID_PCM_S32BE
:
case
AV_CODEC_ID_PCM_S32LE
:
case
AV_CODEC_ID_PCM_S32LE_PLANAR
:
case
AV_CODEC_ID_PCM_U32BE
:
case
AV_CODEC_ID_PCM_U32LE
:
case
AV_CODEC_ID_PCM_F32BE
:
...
...
libavcodec/version.h
View file @
467dfd5d
...
...
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 7
1
#define LIBAVCODEC_VERSION_MINOR 7
2
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
libavformat/nut.c
View file @
467dfd5d
...
...
@@ -168,6 +168,8 @@ const AVCodecTag ff_nut_audio_tags[] = {
{
AV_CODEC_ID_PCM_U32LE
,
MKTAG
(
'P'
,
'U'
,
'D'
,
32
)
},
{
AV_CODEC_ID_PCM_U8
,
MKTAG
(
'P'
,
'U'
,
'D'
,
8
)
},
{
AV_CODEC_ID_PCM_S16LE_PLANAR
,
MKTAG
(
'P'
,
'S'
,
'P'
,
16
)
},
{
AV_CODEC_ID_PCM_S24LE_PLANAR
,
MKTAG
(
'P'
,
'S'
,
'P'
,
24
)
},
{
AV_CODEC_ID_PCM_S32LE_PLANAR
,
MKTAG
(
'P'
,
'S'
,
'P'
,
32
)
},
{
AV_CODEC_ID_NONE
,
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