Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
51a73fbb
Commit
51a73fbb
authored
Apr 30, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Apr 30, 2013
Browse files
Merge "Consistent names for quant-related functions and variables." into experimental
parents
e8315aee
5a5a1f25
Changes
8
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_quant_common.c
View file @
51a73fbb
...
...
@@ -11,45 +11,36 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_quant_common.h"
static
int
dc_qlookup
[
QINDEX_RANGE
];
static
int
ac_qlookup
[
QINDEX_RANGE
];
static
int
16_t
dc_qlookup
[
QINDEX_RANGE
];
static
int
16_t
ac_qlookup
[
QINDEX_RANGE
];
#define ACDC_MIN 4
// TODO(dkovalev) move to common and reuse
static
double
poly3
(
double
a
,
double
b
,
double
c
,
double
d
,
double
x
)
{
return
a
*
x
*
x
*
x
+
b
*
x
*
x
+
c
*
x
+
d
;
}
void
vp9_init_quant_tables
()
{
int
i
;
int
current_val
=
4
;
int
last_val
=
4
;
int
ac_val
;
int
i
,
val
=
4
;
for
(
i
=
0
;
i
<
QINDEX_RANGE
;
i
++
)
{
ac_qlookup
[
i
]
=
current_val
;
current_val
=
(
int
)(
current_val
*
1
.
02
);
if
(
current_val
==
last_val
)
current_val
++
;
last_val
=
current_val
;
ac_val
=
ac_qlookup
[
i
];
dc_qlookup
[
i
]
=
(
int
)((
0
.
000000305
*
ac_val
*
ac_val
*
ac_val
)
+
(
-
0
.
00065
*
ac_val
*
ac_val
)
+
(
0
.
9
*
ac_val
)
+
0
.
5
);
if
(
dc_qlookup
[
i
]
<
ACDC_MIN
)
dc_qlookup
[
i
]
=
ACDC_MIN
;
}
}
const
int
ac_val
=
val
;
int
vp9_dc_quant
(
int
qindex
,
int
delta
)
{
return
dc_qlookup
[
clamp
(
qindex
+
delta
,
0
,
MAXQ
)];
}
val
=
(
int
)(
val
*
1
.
02
);
if
(
val
==
ac_val
)
++
val
;
int
vp9_dc_uv_quant
(
int
qindex
,
int
delta
)
{
return
dc_qlookup
[
clamp
(
qindex
+
delta
,
0
,
MAXQ
)];
ac_qlookup
[
i
]
=
(
int16_t
)
ac_val
;
dc_qlookup
[
i
]
=
(
int16_t
)
MAX
(
ACDC_MIN
,
poly3
(
0
.
000000305
,
-
0
.
00065
,
0
.
9
,
0
.
5
,
ac_val
));
}
}
int
vp9_
a
c_
y
quant
(
int
qindex
)
{
return
a
c_qlookup
[
clamp
(
qindex
,
0
,
MAXQ
)];
int
16_t
vp9_
d
c_quant
(
int
qindex
,
int
delta
)
{
return
d
c_qlookup
[
clamp
(
qindex
+
delta
,
0
,
MAXQ
)];
}
int
vp9_ac_
uv_
quant
(
int
qindex
,
int
delta
)
{
int
16_t
vp9_ac_quant
(
int
qindex
,
int
delta
)
{
return
ac_qlookup
[
clamp
(
qindex
+
delta
,
0
,
MAXQ
)];
}
vp9/common/vp9_quant_common.h
View file @
51a73fbb
...
...
@@ -15,11 +15,8 @@
#include "vp9/common/vp9_onyxc_int.h"
void
vp9_init_quant_tables
();
int
vp9_ac_yquant
(
int
qindex
);
int
vp9_dc_quant
(
int
qindex
,
int
delta
);
int
vp9_dc2quant
(
int
qindex
,
int
delta
);
int
vp9_ac2quant
(
int
qindex
,
int
delta
);
int
vp9_dc_uv_quant
(
int
qindex
,
int
delta
);
int
vp9_ac_uv_quant
(
int
qindex
,
int
delta
);
int16_t
vp9_dc_quant
(
int
qindex
,
int
delta
);
int16_t
vp9_ac_quant
(
int
qindex
,
int
delta
);
#endif // VP9_COMMON_VP9_QUANT_COMMON_H_
vp9/decoder/vp9_decodframe.c
View file @
51a73fbb
...
...
@@ -163,22 +163,20 @@ static vp9_prob read_prob_diff_update(vp9_reader *r, int oldp) {
return
(
vp9_prob
)
inv_remap_prob
(
delp
,
oldp
);
}
void
vp9_init_de_quantizer
(
VP9D_COMP
*
pbi
)
{
int
i
;
int
q
;
VP9_COMMON
*
const
pc
=
&
pbi
->
common
;
void
vp9_init_dequantizer
(
VP9_COMMON
*
pc
)
{
int
q
,
i
;
for
(
q
=
0
;
q
<
QINDEX_RANGE
;
q
++
)
{
// DC value
pc
->
y_dequant
[
q
][
0
]
=
(
int16_t
)
vp9_dc_quant
(
q
,
pc
->
y_dc_delta_q
);
pc
->
uv_dequant
[
q
][
0
]
=
(
int16_t
)
vp9_dc_
uv_
quant
(
q
,
pc
->
uv_dc_delta_q
);
pc
->
y_dequant
[
q
][
0
]
=
vp9_dc_quant
(
q
,
pc
->
y_dc_delta_q
);
pc
->
uv_dequant
[
q
][
0
]
=
vp9_dc_quant
(
q
,
pc
->
uv_dc_delta_q
);
// AC values
for
(
i
=
1
;
i
<
16
;
i
++
)
{
const
int
rc
=
vp9_default_zig_zag1d_4x4
[
i
];
pc
->
y_dequant
[
q
][
rc
]
=
(
int16_t
)
vp9_ac_
y
quant
(
q
);
pc
->
uv_dequant
[
q
][
rc
]
=
(
int16_t
)
vp9_ac_
uv_
quant
(
q
,
pc
->
uv_ac_delta_q
);
pc
->
y_dequant
[
q
][
rc
]
=
vp9_ac_quant
(
q
,
0
);
pc
->
uv_dequant
[
q
][
rc
]
=
vp9_ac_quant
(
q
,
pc
->
uv_ac_delta_q
);
}
}
}
...
...
@@ -1041,7 +1039,7 @@ static void setup_quantization(VP9D_COMP *pbi, vp9_reader *r) {
if
(
get_delta_q
(
r
,
&
pc
->
y_dc_delta_q
)
|
get_delta_q
(
r
,
&
pc
->
uv_dc_delta_q
)
|
get_delta_q
(
r
,
&
pc
->
uv_ac_delta_q
))
vp9_init_de
_
quantizer
(
p
bi
);
vp9_init_dequantizer
(
p
c
);
mb_init_dequantizer
(
pc
,
&
pbi
->
mb
);
// MB level dequantizer setup
}
...
...
vp9/decoder/vp9_decodframe.h
View file @
51a73fbb
...
...
@@ -12,8 +12,8 @@
#ifndef VP9_DECODER_VP9_DECODFRAME_H_
#define VP9_DECODER_VP9_DECODFRAME_H_
struct
VP9
Decompressor
;
struct
VP9
Common
;
void
vp9_init_de
_
quantizer
(
struct
VP9
Decompressor
*
p
bi
);
void
vp9_init_dequantizer
(
struct
VP9
Common
*
p
c
);
#endif // VP9_DECODER_VP9_DECODFRAME_H_
vp9/decoder/vp9_onyxd_if.c
View file @
51a73fbb
...
...
@@ -133,10 +133,10 @@ VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
pbi
->
common
.
current_video_frame
=
0
;
pbi
->
ready_for_new_data
=
1
;
// vp9_init_de
_
quantizer() is first called here. Add check in
// vp9_init_dequantizer() is first called here. Add check in
// frame_init_dequantizer() to avoid unnecessary calling of
// vp9_init_de
_
quantizer() for every frame.
vp9_init_de
_
quantizer
(
pbi
);
// vp9_init_dequantizer() for every frame.
vp9_init_dequantizer
(
&
pbi
->
common
);
vp9_loop_filter_init
(
&
pbi
->
common
);
...
...
vp9/encoder/vp9_quantize.c
View file @
51a73fbb
...
...
@@ -286,7 +286,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
cpi
->
common
.
y_dequant
[
q
][
0
]
=
quant_val
;
cpi
->
zrun_zbin_boost_y1
[
q
][
0
]
=
(
quant_val
*
zbin_boost
[
0
])
>>
7
;
quant_val
=
vp9_dc_
uv_
quant
(
q
,
cpi
->
common
.
uv_dc_delta_q
);
quant_val
=
vp9_dc_quant
(
q
,
cpi
->
common
.
uv_dc_delta_q
);
invert_quant
(
cpi
->
UVquant
[
q
]
+
0
,
cpi
->
UVquant_shift
[
q
]
+
0
,
quant_val
);
cpi
->
UVzbin
[
q
][
0
]
=
ROUND_POWER_OF_TWO
(
qzbin_factor
*
quant_val
,
7
);
cpi
->
UVround
[
q
][
0
]
=
(
qrounding_factor
*
quant_val
)
>>
7
;
...
...
@@ -297,7 +297,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
for
(
i
=
1
;
i
<
16
;
i
++
)
{
int
rc
=
vp9_default_zig_zag1d_4x4
[
i
];
quant_val
=
vp9_ac_
y
quant
(
q
);
quant_val
=
vp9_ac_quant
(
q
,
0
);
invert_quant
(
cpi
->
Y1quant
[
q
]
+
rc
,
cpi
->
Y1quant_shift
[
q
]
+
rc
,
quant_val
);
cpi
->
Y1zbin
[
q
][
rc
]
=
ROUND_POWER_OF_TWO
(
qzbin_factor
*
quant_val
,
7
);
cpi
->
Y1round
[
q
][
rc
]
=
(
qrounding_factor
*
quant_val
)
>>
7
;
...
...
@@ -305,7 +305,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
cpi
->
zrun_zbin_boost_y1
[
q
][
i
]
=
ROUND_POWER_OF_TWO
(
quant_val
*
zbin_boost
[
i
],
7
);
quant_val
=
vp9_ac_
uv_
quant
(
q
,
cpi
->
common
.
uv_ac_delta_q
);
quant_val
=
vp9_ac_quant
(
q
,
cpi
->
common
.
uv_ac_delta_q
);
invert_quant
(
cpi
->
UVquant
[
q
]
+
rc
,
cpi
->
UVquant_shift
[
q
]
+
rc
,
quant_val
);
cpi
->
UVzbin
[
q
][
rc
]
=
ROUND_POWER_OF_TWO
(
qzbin_factor
*
quant_val
,
7
);
cpi
->
UVround
[
q
][
rc
]
=
(
qrounding_factor
*
quant_val
)
>>
7
;
...
...
vp9/encoder/vp9_ratectrl.c
View file @
51a73fbb
...
...
@@ -89,7 +89,7 @@ static const unsigned int prior_key_frame_weight[KEY_FRAME_CONTEXT] = { 1, 2, 3,
// tables if and when things settle down in the experimental bitstream
double
vp9_convert_qindex_to_q
(
int
qindex
)
{
// Convert the index to a real Q value (scaled down to match old Q values)
return
vp9_ac_
y
quant
(
qindex
)
/
4
.
0
;
return
vp9_ac_quant
(
qindex
,
0
)
/
4
.
0
;
}
int
vp9_gfboost_qadjust
(
int
qindex
)
{
...
...
vp9/encoder/vp9_rdopt.c
View file @
51a73fbb
...
...
@@ -187,7 +187,7 @@ void vp9_init_me_luts() {
}
static
int
compute_rd_mult
(
int
qindex
)
{
int
q
=
vp9_dc_quant
(
qindex
,
0
);
const
int
q
=
vp9_dc_quant
(
qindex
,
0
);
return
(
11
*
q
*
q
)
>>
2
;
}
...
...
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