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
5bcdc099
Commit
5bcdc099
authored
Jul 24, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnxhddec: cache luma/chroma_weight*qscale tables for last qscale
parent
9dfd89b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
dnxhddec.c
libavcodec/dnxhddec.c
+15
-1
No files found.
libavcodec/dnxhddec.c
View file @
5bcdc099
...
...
@@ -49,6 +49,9 @@ typedef struct DNXHDContext {
int
bit_depth
;
// 8, 10 or 0 if not initialized at all.
void
(
*
decode_dct_block
)(
struct
DNXHDContext
*
ctx
,
DCTELEM
*
block
,
int
n
,
int
qscale
);
int
last_qscale
;
int
luma_scale
[
64
];
int
chroma_scale
[
64
];
}
DNXHDContext
;
#define DNXHD_VLC_BITS 9
...
...
@@ -181,6 +184,7 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
{
int
i
,
j
,
index1
,
index2
,
len
,
flags
;
int
level
,
component
,
sign
;
const
int
*
scale
;
const
uint8_t
*
weight_matrix
;
const
uint8_t
*
ac_level
=
ctx
->
cid_table
->
ac_level
;
const
uint8_t
*
ac_flags
=
ctx
->
cid_table
->
ac_flags
;
...
...
@@ -189,9 +193,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
if
(
n
&
2
)
{
component
=
1
+
(
n
&
1
);
scale
=
ctx
->
chroma_scale
;
weight_matrix
=
ctx
->
cid_table
->
chroma_weight
;
}
else
{
component
=
0
;
scale
=
ctx
->
luma_scale
;
weight_matrix
=
ctx
->
cid_table
->
luma_weight
;
}
...
...
@@ -240,7 +246,7 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
j
=
ctx
->
scantable
.
permutated
[
i
];
//av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
//av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]);
level
*=
qscale
*
weight_matrix
[
i
];
level
*=
scale
[
i
];
if
(
level_bias
<
32
||
weight_matrix
[
i
]
!=
level_bias
)
level
+=
level_bias
;
level
>>=
level_shift
;
...
...
@@ -281,6 +287,14 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
skip_bits1
(
&
ctx
->
gb
);
//av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale);
if
(
qscale
!=
ctx
->
last_qscale
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
ctx
->
luma_scale
[
i
]
=
qscale
*
ctx
->
cid_table
->
luma_weight
[
i
];
ctx
->
chroma_scale
[
i
]
=
qscale
*
ctx
->
cid_table
->
chroma_weight
[
i
];
}
ctx
->
last_qscale
=
qscale
;
}
for
(
i
=
0
;
i
<
8
;
i
++
)
{
ctx
->
dsp
.
clear_block
(
ctx
->
blocks
[
i
]);
ctx
->
decode_dct_block
(
ctx
,
ctx
->
blocks
[
i
],
i
,
qscale
);
...
...
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