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
9000b6db
Commit
9000b6db
authored
Sep 14, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shorten: separate processing of audio commands from non-audio commands
parent
07745485
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
34 deletions
+39
-34
shorten.c
libavcodec/shorten.c
+39
-34
No files found.
libavcodec/shorten.c
View file @
9000b6db
...
...
@@ -69,6 +69,9 @@
#define FN_ZERO 8
#define FN_VERBATIM 9
/** indicates if the FN_* command is audio or non-audio */
static
const
uint8_t
is_audio_command
[
10
]
=
{
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
};
#define VERBATIM_CKSIZE_SIZE 5
#define VERBATIM_BYTE_SIZE 8
#define CANONICAL_HEADER_SIZE 44
...
...
@@ -388,14 +391,42 @@ static int shorten_decode_frame(AVCodecContext *avctx,
int
cmd
;
int
len
;
cmd
=
get_ur_golomb_shorten
(
&
s
->
gb
,
FNSIZE
);
switch
(
cmd
)
{
case
FN_ZERO
:
case
FN_DIFF0
:
case
FN_DIFF1
:
case
FN_DIFF2
:
case
FN_DIFF3
:
case
FN_QLPC
:
{
if
(
cmd
>
FN_VERBATIM
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"unknown shorten function %d
\n
"
,
cmd
);
if
(
s
->
bitstream_size
>
0
)
{
s
->
bitstream_index
++
;
s
->
bitstream_size
--
;
}
return
-
1
;
}
if
(
!
is_audio_command
[
cmd
])
{
/* process non-audio command */
switch
(
cmd
)
{
case
FN_VERBATIM
:
len
=
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_CKSIZE_SIZE
);
while
(
len
--
)
{
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_BYTE_SIZE
);
}
break
;
case
FN_BITSHIFT
:
s
->
bitshift
=
get_ur_golomb_shorten
(
&
s
->
gb
,
BITSHIFTSIZE
);
break
;
case
FN_BLOCKSIZE
:
{
int
blocksize
=
get_uint
(
s
,
av_log2
(
s
->
blocksize
));
if
(
blocksize
>
s
->
blocksize
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Increasing block size is not supported
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
s
->
blocksize
=
blocksize
;
break
;
}
case
FN_QUIT
:
goto
frame_done
;
}
}
else
{
/* process audio command */
int
residual_size
=
0
;
int
channel
=
s
->
cur_chan
;
int32_t
coffset
;
...
...
@@ -481,32 +512,6 @@ static int shorten_decode_frame(AVCodecContext *avctx,
s
->
cur_chan
=
0
;
goto
frame_done
;
}
}
break
;
case
FN_VERBATIM
:
len
=
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_CKSIZE_SIZE
);
while
(
len
--
)
{
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_BYTE_SIZE
);
}
break
;
case
FN_BITSHIFT
:
s
->
bitshift
=
get_ur_golomb_shorten
(
&
s
->
gb
,
BITSHIFTSIZE
);
break
;
case
FN_BLOCKSIZE
:
{
int
blocksize
=
get_uint
(
s
,
av_log2
(
s
->
blocksize
));
if
(
blocksize
>
s
->
blocksize
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Increasing block size is not supported
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
s
->
blocksize
=
blocksize
;
break
;
}
case
FN_QUIT
:
*
data_size
=
0
;
return
buf_size
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"unknown shorten function %d
\n
"
,
cmd
);
return
-
1
;
}
}
frame_done:
...
...
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