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
dbb45a3b
Commit
dbb45a3b
authored
Jul 16, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log prediction order search method
Originally committed as revision 5763 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
26053bdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
flacenc.c
libavcodec/flacenc.c
+24
-1
No files found.
libavcodec/flacenc.c
View file @
dbb45a3b
...
...
@@ -43,6 +43,7 @@
#define ORDER_METHOD_4LEVEL 2
#define ORDER_METHOD_8LEVEL 3
#define ORDER_METHOD_SEARCH 4
#define ORDER_METHOD_LOG 5
#define FLAC_STREAMINFO_SIZE 34
...
...
@@ -291,7 +292,7 @@ static int flac_encode_init(AVCodecContext *avctx)
s
->
options
.
min_prediction_order
,
s
->
options
.
max_prediction_order
);
if
(
avctx
->
prediction_order_method
>=
0
)
{
if
(
avctx
->
prediction_order_method
>
ORDER_METHOD_
SEARCH
)
{
if
(
avctx
->
prediction_order_method
>
ORDER_METHOD_
LOG
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid prediction order method: %d
\n
"
,
avctx
->
prediction_order_method
);
return
-
1
;
...
...
@@ -309,6 +310,8 @@ static int flac_encode_init(AVCodecContext *avctx)
"8-level"
);
break
;
case
ORDER_METHOD_SEARCH
:
av_log
(
avctx
,
AV_LOG_DEBUG
,
" order method: %s
\n
"
,
"full search"
);
break
;
case
ORDER_METHOD_LOG
:
av_log
(
avctx
,
AV_LOG_DEBUG
,
" order method: %s
\n
"
,
"log search"
);
break
;
}
if
(
avctx
->
min_partition_order
>=
0
)
{
...
...
@@ -951,6 +954,26 @@ static int encode_residual(FlacEncodeContext *ctx, int ch)
}
}
opt_order
++
;
}
else
if
(
omethod
==
ORDER_METHOD_LOG
)
{
uint32_t
bits
[
MAX_LPC_ORDER
];
int
step
;
opt_order
=
min_order
-
1
+
(
max_order
-
min_order
)
/
3
;
memset
(
bits
,
-
1
,
sizeof
(
bits
));
for
(
step
=
16
;
step
;
step
>>=
1
){
int
last
=
opt_order
;
for
(
i
=
last
-
step
;
i
<=
last
+
step
;
i
+=
step
){
if
(
i
<
min_order
-
1
||
i
>=
max_order
||
bits
[
i
]
<
UINT32_MAX
)
continue
;
encode_residual_lpc
(
res
,
smp
,
n
,
i
+
1
,
coefs
[
i
],
shift
[
i
]);
bits
[
i
]
=
calc_rice_params_lpc
(
&
sub
->
rc
,
min_porder
,
max_porder
,
res
,
n
,
i
+
1
,
sub
->
obits
,
precision
);
if
(
bits
[
i
]
<
bits
[
opt_order
])
opt_order
=
i
;
}
}
opt_order
++
;
}
sub
->
order
=
opt_order
;
...
...
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