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
a34be785
Commit
a34be785
authored
Aug 28, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ralf: use planar sample format
parent
1a345903
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
ralf.c
libavcodec/ralf.c
+20
-15
No files found.
libavcodec/ralf.c
View file @
a34be785
...
@@ -149,7 +149,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -149,7 +149,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx
->
sample_rate
,
avctx
->
channels
);
avctx
->
sample_rate
,
avctx
->
channels
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
P
;
avctx
->
channel_layout
=
(
avctx
->
channels
==
2
)
?
AV_CH_LAYOUT_STEREO
avctx
->
channel_layout
=
(
avctx
->
channels
==
2
)
?
AV_CH_LAYOUT_STEREO
:
AV_CH_LAYOUT_MONO
;
:
AV_CH_LAYOUT_MONO
;
...
@@ -338,7 +338,8 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
...
@@ -338,7 +338,8 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
}
}
}
}
static
int
decode_block
(
AVCodecContext
*
avctx
,
GetBitContext
*
gb
,
int16_t
*
dst
)
static
int
decode_block
(
AVCodecContext
*
avctx
,
GetBitContext
*
gb
,
int16_t
*
dst0
,
int16_t
*
dst1
)
{
{
RALFContext
*
ctx
=
avctx
->
priv_data
;
RALFContext
*
ctx
=
avctx
->
priv_data
;
int
len
,
ch
,
ret
;
int
len
,
ch
,
ret
;
...
@@ -382,35 +383,35 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int16_t *dst)
...
@@ -382,35 +383,35 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int16_t *dst)
switch
(
dmode
)
{
switch
(
dmode
)
{
case
0
:
case
0
:
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
*
dst
++
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
dst0
[
i
]
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
break
;
break
;
case
1
:
case
1
:
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
*
dst
++
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
dst0
[
i
]
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
*
dst
++
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
dst1
[
i
]
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
}
}
break
;
break
;
case
2
:
case
2
:
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
ch0
[
i
]
+=
ctx
->
bias
[
0
];
ch0
[
i
]
+=
ctx
->
bias
[
0
];
*
dst
++
=
ch0
[
i
];
dst0
[
i
]
=
ch0
[
i
];
*
dst
++
=
ch0
[
i
]
-
(
ch1
[
i
]
+
ctx
->
bias
[
1
]);
dst1
[
i
]
=
ch0
[
i
]
-
(
ch1
[
i
]
+
ctx
->
bias
[
1
]);
}
}
break
;
break
;
case
3
:
case
3
:
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
t
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
t
=
ch0
[
i
]
+
ctx
->
bias
[
0
];
t2
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
t2
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
*
dst
++
=
t
+
t2
;
dst0
[
i
]
=
t
+
t2
;
*
dst
++
=
t
;
dst1
[
i
]
=
t
;
}
}
break
;
break
;
case
4
:
case
4
:
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
t
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
t
=
ch1
[
i
]
+
ctx
->
bias
[
1
];
t2
=
((
ch0
[
i
]
+
ctx
->
bias
[
0
])
<<
1
)
|
(
t
&
1
);
t2
=
((
ch0
[
i
]
+
ctx
->
bias
[
0
])
<<
1
)
|
(
t
&
1
);
*
dst
++
=
(
t2
+
t
)
/
2
;
dst0
[
i
]
=
(
t2
+
t
)
/
2
;
*
dst
++
=
(
t2
-
t
)
/
2
;
dst1
[
i
]
=
(
t2
-
t
)
/
2
;
}
}
break
;
break
;
}
}
...
@@ -424,7 +425,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
...
@@ -424,7 +425,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
AVPacket
*
avpkt
)
AVPacket
*
avpkt
)
{
{
RALFContext
*
ctx
=
avctx
->
priv_data
;
RALFContext
*
ctx
=
avctx
->
priv_data
;
int16_t
*
samples
;
int16_t
*
samples0
;
int16_t
*
samples1
;
int
ret
;
int
ret
;
GetBitContext
gb
;
GetBitContext
gb
;
int
table_size
,
table_bytes
,
i
;
int
table_size
,
table_bytes
,
i
;
...
@@ -465,7 +467,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
...
@@ -465,7 +467,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Me fail get_buffer()? That's unpossible!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Me fail get_buffer()? That's unpossible!
\n
"
);
return
ret
;
return
ret
;
}
}
samples
=
(
int16_t
*
)
ctx
->
frame
.
data
[
0
];
samples0
=
(
int16_t
*
)
ctx
->
frame
.
data
[
0
];
samples1
=
(
int16_t
*
)
ctx
->
frame
.
data
[
1
];
if
(
src_size
<
5
)
{
if
(
src_size
<
5
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"too short packets are too short!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"too short packets are too short!
\n
"
);
...
@@ -498,8 +501,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
...
@@ -498,8 +501,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
break
;
break
;
}
}
init_get_bits
(
&
gb
,
block_pointer
,
ctx
->
block_size
[
i
]
*
8
);
init_get_bits
(
&
gb
,
block_pointer
,
ctx
->
block_size
[
i
]
*
8
);
if
(
decode_block
(
avctx
,
&
gb
,
samples
+
ctx
->
sample_offset
if
(
decode_block
(
avctx
,
&
gb
,
samples
0
+
ctx
->
sample_offset
,
*
avctx
->
channels
)
<
0
)
{
samples1
+
ctx
->
sample_offset
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Sir, I got carsick in your office. Not decoding the rest of packet.
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Sir, I got carsick in your office. Not decoding the rest of packet.
\n
"
);
break
;
break
;
}
}
...
@@ -533,4 +536,6 @@ AVCodec ff_ralf_decoder = {
...
@@ -533,4 +536,6 @@ AVCodec ff_ralf_decoder = {
.
flush
=
decode_flush
,
.
flush
=
decode_flush
,
.
capabilities
=
CODEC_CAP_DR1
,
.
capabilities
=
CODEC_CAP_DR1
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"RealAudio Lossless"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"RealAudio Lossless"
),
.
sample_fmts
=
(
const
enum
AVSampleFormat
[])
{
AV_SAMPLE_FMT_S16P
,
AV_SAMPLE_FMT_NONE
},
};
};
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