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
cc16c5d8
Commit
cc16c5d8
authored
Jun 27, 2016
by
Sarah Parker
Committed by
Gerrit Code Review
Jun 27, 2016
Browse files
Merge "Add multiple quantization profiles to new_quant experiment" into nextgenv2
parents
9f2167ae
fbe6fb27
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
vp10/common/blockd.h
View file @
cc16c5d8
...
...
@@ -31,6 +31,14 @@
extern
"C"
{
#endif
#if CONFIG_NEW_QUANT
#define QUANT_PROFILES 3
static
INLINE
int
get_dq_profile_from_ctx
(
int
q_ctx
)
{
return
VPXMIN
(
q_ctx
,
QUANT_PROFILES
-
1
);
}
#endif // CONFIG_NEW_QUANT
#define MAX_MB_PLANE 3
typedef
enum
{
...
...
@@ -224,7 +232,8 @@ typedef struct macroblockd_plane {
ENTROPY_CONTEXT
*
left_context
;
int16_t
seg_dequant
[
MAX_SEGMENTS
][
2
];
#if CONFIG_NEW_QUANT
dequant_val_type_nuq
seg_dequant_nuq
[
MAX_SEGMENTS
][
COEF_BANDS
];
dequant_val_type_nuq
seg_dequant_nuq
[
MAX_SEGMENTS
][
QUANT_PROFILES
][
COEF_BANDS
];
#endif
uint8_t
*
color_index_map
;
...
...
@@ -236,7 +245,7 @@ typedef struct macroblockd_plane {
// encoder
const
int16_t
*
dequant
;
#if CONFIG_NEW_QUANT
const
dequant_val_type_nuq
*
dequant_val_nuq
;
const
dequant_val_type_nuq
*
dequant_val_nuq
[
QUANT_PROFILES
]
;
#endif // CONFIG_NEW_QUANT
}
MACROBLOCKD_PLANE
;
...
...
vp10/common/onyxc_int.h
View file @
cc16c5d8
...
...
@@ -220,8 +220,8 @@ typedef struct VP10Common {
int16_t
y_dequant
[
MAX_SEGMENTS
][
2
];
int16_t
uv_dequant
[
MAX_SEGMENTS
][
2
];
#if CONFIG_NEW_QUANT
dequant_val_type_nuq
y_dequant_nuq
[
MAX_SEGMENTS
][
COEF_BANDS
];
dequant_val_type_nuq
uv_dequant_nuq
[
MAX_SEGMENTS
][
COEF_BANDS
];
dequant_val_type_nuq
y_dequant_nuq
[
MAX_SEGMENTS
][
QUANT_PROFILES
][
COEF_BANDS
];
dequant_val_type_nuq
uv_dequant_nuq
[
MAX_SEGMENTS
][
QUANT_PROFILES
][
COEF_BANDS
];
#endif
/* We allocate a MODE_INFO struct for each macroblock, together with
...
...
vp10/common/quant_common.c
View file @
cc16c5d8
...
...
@@ -12,6 +12,7 @@
#include "vp10/common/entropy.h"
#include "vp10/common/quant_common.h"
#include "vp10/common/seg_common.h"
#include "vp10/common/blockd.h"
#if CONFIG_NEW_QUANT
// Bin widths expressed as a fraction over 128 of the quant stepsize,
...
...
@@ -32,39 +33,76 @@ static const uint8_t nuq_knots_lossless[COEF_BANDS][NUQ_KNOTS] = {
{
64
,
128
,
128
},
// band 5
};
// TODO(sarahparker) add multiple quantization profiles
static
const
uint8_t
nuq_knots
[
COEF_BANDS
][
NUQ_KNOTS
]
=
{
static
const
uint8_t
nuq_knots
[
QUANT_PROFILES
][
COEF_BANDS
][
NUQ_KNOTS
]
=
{
{
{
91
,
133
,
139
},
// dc, band 0
{
78
,
122
,
134
},
// band 1
{
83
,
127
,
139
},
// band 2
{
84
,
117
,
128
},
// band 3
{
88
,
117
,
129
},
// band 4
{
93
,
122
,
134
},
// band 5
},
#if QUANT_PROFILES > 1
{
{
86
,
122
,
134
},
// dc, band 0
{
78
,
122
,
134
},
// band 1
{
78
,
122
,
134
},
// band 2
{
84
,
122
,
134
},
// band 3
{
88
,
122
,
134
},
// band 4
{
88
,
122
,
134
},
// band 5
},
#if QUANT_PROFILES > 2
{
{
86
,
122
,
134
},
// dc, band 0
{
78
,
122
,
135
},
// band 1
{
78
,
122
,
134
},
// band 2
{
84
,
122
,
133
},
// band 3
{
88
,
122
,
134
},
// band 4
{
88
,
122
,
134
},
// band 5
}
#endif // QUANT_PROFILES > 2
#endif // QUANT_PROFILES > 1
};
// dequantization offsets
static
const
uint8_t
nuq_doff_lossless
[
COEF_BANDS
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
static
const
uint8_t
nuq_doff
[
COEF_BANDS
]
=
{
11
,
12
,
22
,
18
,
20
,
21
};
#if QUANT_PROFILES == 1
static
const
uint8_t
nuq_doff
[
QUANT_PROFILES
][
COEF_BANDS
]
=
{
{
11
,
12
,
22
,
18
,
20
,
21
}
// dq_off_index = 0
};
#elif QUANT_PROFILES == 2
static
const
uint8_t
nuq_doff
[
QUANT_PROFILES
][
COEF_BANDS
]
=
{
{
11
,
12
,
22
,
18
,
20
,
21
},
// dq_off_index = 0
{
13
,
20
,
21
,
27
,
28
,
29
}
// dq_off_index = 1
};
#else // QUANT_PROFILES == 3
static
const
uint8_t
nuq_doff
[
QUANT_PROFILES
][
COEF_BANDS
]
=
{
{
11
,
12
,
22
,
18
,
20
,
21
},
// dq_off_index = 0
{
6
,
15
,
17
,
22
,
23
,
23
},
// dq_off_index = 1
{
6
,
14
,
16
,
22
,
23
,
27
}
// dq_off_index = 2
};
#endif // QUANT_PROFILES == x
static
const
uint8_t
*
get_nuq_knots
(
int
lossless
,
int
band
)
{
static
const
uint8_t
*
get_nuq_knots
(
int
lossless
,
int
band
,
int
dq_off_index
)
{
if
(
lossless
)
return
nuq_knots_lossless
[
band
];
else
return
nuq_knots
[
band
];
return
nuq_knots
[
dq_off_index
][
band
];
}
static
INLINE
int16_t
quant_to_doff_fixed
(
int
lossless
,
int
band
)
{
static
INLINE
int16_t
quant_to_doff_fixed
(
int
lossless
,
int
band
,
int
dq_off_index
)
{
if
(
lossless
)
return
nuq_doff_lossless
[
band
];
else
return
nuq_doff
[
band
];
return
nuq_doff
[
dq_off_index
][
band
];
}
// get cumulative bins
static
INLINE
void
get_cuml_bins_nuq
(
int
q
,
int
lossless
,
int
band
,
tran_low_t
*
cuml_bins
)
{
const
uint8_t
*
knots
=
get_nuq_knots
(
lossless
,
band
);
tran_low_t
*
cuml_bins
,
int
dq_off_index
)
{
const
uint8_t
*
knots
=
get_nuq_knots
(
lossless
,
band
,
dq_off_index
);
int16_t
cuml_knots
[
NUQ_KNOTS
];
int
i
;
cuml_knots
[
0
]
=
knots
[
0
];
...
...
@@ -75,21 +113,22 @@ static INLINE void get_cuml_bins_nuq(int q, int lossless, int band,
}
void
get_dequant_val_nuq
(
int
q
,
int
lossless
,
int
band
,
tran_low_t
*
dq
,
tran_low_t
*
cuml_bins
)
{
const
uint8_t
*
knots
=
get_nuq_knots
(
lossless
,
band
);
tran_low_t
*
dq
,
tran_low_t
*
cuml_bins
,
int
dq_off_index
)
{
const
uint8_t
*
knots
=
get_nuq_knots
(
lossless
,
band
,
dq_off_index
);
tran_low_t
cuml_bins_
[
NUQ_KNOTS
],
*
cuml_bins_ptr
;
tran_low_t
doff
;
int
i
;
cuml_bins_ptr
=
(
cuml_bins
?
cuml_bins
:
cuml_bins_
);
get_cuml_bins_nuq
(
q
,
lossless
,
band
,
cuml_bins_ptr
);
get_cuml_bins_nuq
(
q
,
lossless
,
band
,
cuml_bins_ptr
,
dq_off_index
);
dq
[
0
]
=
0
;
for
(
i
=
1
;
i
<
NUQ_KNOTS
;
++
i
)
{
doff
=
quant_to_doff_fixed
(
lossless
,
band
);
doff
=
quant_to_doff_fixed
(
lossless
,
band
,
dq_off_index
);
doff
=
ROUND_POWER_OF_TWO
(
doff
*
knots
[
i
],
7
);
dq
[
i
]
=
cuml_bins_ptr
[
i
-
1
]
+
ROUND_POWER_OF_TWO
((
knots
[
i
]
-
doff
*
2
)
*
q
,
8
);
}
doff
=
quant_to_doff_fixed
(
lossless
,
band
);
doff
=
quant_to_doff_fixed
(
lossless
,
band
,
dq_off_index
);
dq
[
NUQ_KNOTS
]
=
cuml_bins_ptr
[
NUQ_KNOTS
-
1
]
+
ROUND_POWER_OF_TWO
((
64
-
doff
)
*
q
,
7
);
}
...
...
vp10/common/quant_common.h
View file @
cc16c5d8
...
...
@@ -34,7 +34,8 @@ int vp10_get_qindex(const struct segmentation *seg, int segment_id,
typedef
tran_low_t
dequant_val_type_nuq
[
NUQ_KNOTS
+
1
];
typedef
tran_low_t
cuml_bins_type_nuq
[
NUQ_KNOTS
];
void
get_dequant_val_nuq
(
int
q
,
int
lossless
,
int
band
,
tran_low_t
*
dq
,
tran_low_t
*
cumbins
);
tran_low_t
*
dq
,
tran_low_t
*
cuml_bins
,
int
dq_off_index
);
tran_low_t
dequant_abscoeff_nuq
(
int
v
,
int
q
,
const
tran_low_t
*
dq
);
tran_low_t
dequant_coeff_nuq
(
int
v
,
int
q
,
const
tran_low_t
*
dq
);
#endif // CONFIG_NEW_QUANT
...
...
vp10/decoder/decodeframe.c
View file @
cc16c5d8
...
...
@@ -2077,7 +2077,8 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
// Build y/uv dequant values based on segmentation.
#if CONFIG_NEW_QUANT
int
b
;
#endif
int
dq
;
#endif // CONFIG_NEW_QUANT
if
(
cm
->
seg
.
enabled
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_SEGMENTS
;
++
i
)
{
...
...
@@ -2090,15 +2091,17 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
cm
->
uv_dequant
[
i
][
1
]
=
vp10_ac_quant
(
qindex
,
cm
->
uv_ac_delta_q
,
cm
->
bit_depth
);
#if CONFIG_NEW_QUANT
for
(
b
=
0
;
b
<
COEF_BANDS
;
++
b
)
{
get_dequant_val_nuq
(
cm
->
y_dequant
[
i
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
y_dequant_nuq
[
i
][
b
],
NULL
);
get_dequant_val_nuq
(
cm
->
uv_dequant
[
i
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
uv_dequant_nuq
[
i
][
b
],
NULL
);
for
(
dq
=
0
;
dq
<
QUANT_PROFILES
;
dq
++
)
{
for
(
b
=
0
;
b
<
COEF_BANDS
;
++
b
)
{
get_dequant_val_nuq
(
cm
->
y_dequant
[
i
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
y_dequant_nuq
[
i
][
dq
][
b
],
NULL
,
dq
);
get_dequant_val_nuq
(
cm
->
uv_dequant
[
i
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
uv_dequant_nuq
[
i
][
dq
][
b
],
NULL
,
dq
);
}
}
#endif
#endif
// CONFIG_NEW_QUANT
}
}
else
{
const
int
qindex
=
cm
->
base_qindex
;
...
...
@@ -2111,15 +2114,17 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
cm
->
uv_dequant
[
0
][
1
]
=
vp10_ac_quant
(
qindex
,
cm
->
uv_ac_delta_q
,
cm
->
bit_depth
);
#if CONFIG_NEW_QUANT
for
(
b
=
0
;
b
<
COEF_BANDS
;
++
b
)
{
get_dequant_val_nuq
(
cm
->
y_dequant
[
0
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
y_dequant_nuq
[
0
][
b
],
NULL
);
get_dequant_val_nuq
(
cm
->
uv_dequant
[
0
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
uv_dequant_nuq
[
0
][
b
],
NULL
);
for
(
dq
=
0
;
dq
<
QUANT_PROFILES
;
dq
++
)
{
for
(
b
=
0
;
b
<
COEF_BANDS
;
++
b
)
{
get_dequant_val_nuq
(
cm
->
y_dequant
[
0
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
y_dequant_nuq
[
0
][
dq
][
b
],
NULL
,
dq
);
get_dequant_val_nuq
(
cm
->
uv_dequant
[
0
][
b
!=
0
],
qindex
==
0
,
b
,
cm
->
uv_dequant_nuq
[
0
][
dq
][
b
],
NULL
,
dq
);
}
}
#endif
#endif
// CONFIG_NEW_QUANT
}
}
...
...
vp10/decoder/detokenize.c
View file @
cc16c5d8
...
...
@@ -506,12 +506,16 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
const
int16_t
*
const
dequant
=
pd
->
seg_dequant
[
seg_id
];
const
int
ctx
=
get_entropy_context
(
tx_size
,
pd
->
above_context
+
x
,
pd
->
left_context
+
y
);
#if CONFIG_NEW_QUANT
int
dq
=
get_dq_profile_from_ctx
(
ctx
);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_ANS
const
int
eob
=
decode_coefs
(
xd
,
pd
->
plane_type
,
pd
->
dqcoeff
,
tx_size
,
tx_type
,
dequant
,
#if CONFIG_NEW_QUANT
pd
->
seg_dequant_nuq
[
seg_id
],
pd
->
seg_dequant_nuq
[
seg_id
]
[
dq
]
,
#endif // CONFIG_NEW_QUANT
ctx
,
sc
->
scan
,
sc
->
neighbors
,
r
);
#else
...
...
@@ -519,7 +523,7 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
pd
->
dqcoeff
,
tx_size
,
tx_type
,
dequant
,
#if CONFIG_NEW_QUANT
pd
->
seg_dequant_nuq
[
seg_id
],
pd
->
seg_dequant_nuq
[
seg_id
]
[
dq
]
,
#endif // CONFIG_NEW_QUANT
ctx
,
sc
->
scan
,
sc
->
neighbors
,
r
);
#endif // !CONFIG_ANS
...
...
vp10/encoder/block.h
View file @
cc16c5d8
...
...
@@ -42,7 +42,7 @@ typedef struct macroblock_plane {
const
int16_t
*
zbin
;
const
int16_t
*
round
;
#if CONFIG_NEW_QUANT
const
cuml_bins_type_nuq
*
cuml_bins_nuq
;
cuml_bins_type_nuq
*
cuml_bins_nuq
[
QUANT_PROFILES
]
;
#endif // CONFIG_NEW_QUANT
int64_t
quant_thred
[
2
];
...
...
vp10/encoder/encodemb.c
View file @
cc16c5d8
This diff is collapsed.
Click to expand it.
vp10/encoder/encodemb.h
View file @
cc16c5d8
...
...
@@ -18,6 +18,11 @@
extern
"C"
{
#endif
struct
optimize_ctx
{
ENTROPY_CONTEXT
ta
[
MAX_MB_PLANE
][
2
*
MAX_MIB_SIZE
];
ENTROPY_CONTEXT
tl
[
MAX_MB_PLANE
][
2
*
MAX_MIB_SIZE
];
};
struct
encode_b_args
{
MACROBLOCK
*
x
;
struct
optimize_ctx
*
ctx
;
...
...
@@ -46,16 +51,17 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
#if CONFIG_NEW_QUANT
void
vp10_xform_quant_nuq
(
MACROBLOCK
*
x
,
int
plane
,
int
block
,
int
blk_row
,
int
blk_col
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
);
TX_SIZE
tx_size
,
int
ctx
);
void
vp10_xform_quant_dc_nuq
(
MACROBLOCK
*
x
,
int
plane
,
int
block
,
int
blk_row
,
int
blk_col
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
);
TX_SIZE
tx_size
,
int
ctx
);
void
vp10_xform_quant_fp_nuq
(
MACROBLOCK
*
x
,
int
plane
,
int
block
,
int
blk_row
,
int
blk_col
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
);
TX_SIZE
tx_size
,
int
ctx
);
void
vp10_xform_quant_dc_fp_nuq
(
MACROBLOCK
*
x
,
int
plane
,
int
block
,
int
blk_row
,
int
blk_col
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
);
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
,
int
ctx
);
#endif
int
vp10_optimize_b
(
MACROBLOCK
*
mb
,
int
plane
,
int
block
,
...
...
vp10/encoder/encoder.h
View file @
cc16c5d8
...
...
@@ -334,9 +334,9 @@ typedef struct VP10_COMP {
DECLARE_ALIGNED
(
16
,
int16_t
,
uv_dequant
[
QINDEX_RANGE
][
8
]);
// 8: SIMD width
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED
(
16
,
dequant_val_type_nuq
,
y_dequant_val_nuq
[
QINDEX_RANGE
][
COEF_BANDS
]);
y_dequant_val_nuq
[
QUANT_PROFILES
][
QINDEX_RANGE
][
COEF_BANDS
]);
DECLARE_ALIGNED
(
16
,
dequant_val_type_nuq
,
uv_dequant_val_nuq
[
QINDEX_RANGE
][
COEF_BANDS
]);
uv_dequant_val_nuq
[
QUANT_PROFILES
][
QINDEX_RANGE
][
COEF_BANDS
]);
#endif // CONFIG_NEW_QUANT
VP10_COMMON
common
;
VP10EncoderConfig
oxcf
;
...
...
vp10/encoder/quantize.c
View file @
cc16c5d8
...
...
@@ -1191,6 +1191,9 @@ void vp10_init_quantizer(VP10_COMP *cpi) {
VP10_COMMON
*
const
cm
=
&
cpi
->
common
;
QUANTS
*
const
quants
=
&
cpi
->
quants
;
int
i
,
q
,
quant
;
#if CONFIG_NEW_QUANT
int
dq
;
#endif
for
(
q
=
0
;
q
<
QINDEX_RANGE
;
q
++
)
{
const
int
qzbin_factor
=
get_qzbin_factor
(
q
,
cm
->
bit_depth
);
...
...
@@ -1221,16 +1224,17 @@ void vp10_init_quantizer(VP10_COMP *cpi) {
}
#if CONFIG_NEW_QUANT
// TODO(sarahparker) do this for multiple profiles once they are added
for
(
i
=
0
;
i
<
COEF_BANDS
;
i
++
)
{
const
int
quant
=
cpi
->
y_dequant
[
q
][
i
!=
0
];
const
int
uvquant
=
cpi
->
uv_dequant
[
q
][
i
!=
0
];
get_dequant_val_nuq
(
quant
,
q
==
0
,
i
,
cpi
->
y_dequant_val_nuq
[
q
][
i
],
quants
->
y_cuml_bins_nuq
[
q
][
i
]);
get_dequant_val_nuq
(
uvquant
,
q
==
0
,
i
,
cpi
->
uv_dequant_val_nuq
[
q
][
i
],
quants
->
uv_cuml_bins_nuq
[
q
][
i
]);
for
(
dq
=
0
;
dq
<
QUANT_PROFILES
;
dq
++
)
{
for
(
i
=
0
;
i
<
COEF_BANDS
;
i
++
)
{
const
int
quant
=
cpi
->
y_dequant
[
q
][
i
!=
0
];
const
int
uvquant
=
cpi
->
uv_dequant
[
q
][
i
!=
0
];
get_dequant_val_nuq
(
quant
,
q
==
0
,
i
,
cpi
->
y_dequant_val_nuq
[
dq
][
q
][
i
],
quants
->
y_cuml_bins_nuq
[
dq
][
q
][
i
],
dq
);
get_dequant_val_nuq
(
uvquant
,
q
==
0
,
i
,
cpi
->
uv_dequant_val_nuq
[
dq
][
q
][
i
],
quants
->
uv_cuml_bins_nuq
[
dq
][
q
][
i
],
dq
);
}
}
#endif // CONFIG_NEW_QUANT
...
...
@@ -1262,6 +1266,9 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
const
int
qindex
=
vp10_get_qindex
(
&
cm
->
seg
,
segment_id
,
cm
->
base_qindex
);
const
int
rdmult
=
vp10_compute_rd_mult
(
cpi
,
qindex
+
cm
->
y_dc_delta_q
);
int
i
;
#if CONFIG_NEW_QUANT
int
dq
;
#endif
// Y
x
->
plane
[
0
].
quant
=
quants
->
y_quant
[
qindex
];
...
...
@@ -1272,8 +1279,12 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
x
->
plane
[
0
].
round
=
quants
->
y_round
[
qindex
];
xd
->
plane
[
0
].
dequant
=
cpi
->
y_dequant
[
qindex
];
#if CONFIG_NEW_QUANT
x
->
plane
[
0
].
cuml_bins_nuq
=
quants
->
y_cuml_bins_nuq
[
qindex
];
xd
->
plane
[
0
].
dequant_val_nuq
=
cpi
->
y_dequant_val_nuq
[
qindex
];
for
(
dq
=
0
;
dq
<
QUANT_PROFILES
;
dq
++
)
{
x
->
plane
[
0
].
cuml_bins_nuq
[
dq
]
=
(
cuml_bins_type_nuq
*
)
quants
->
y_cuml_bins_nuq
[
dq
][
qindex
];
xd
->
plane
[
0
].
dequant_val_nuq
[
dq
]
=
(
const
dequant_val_type_nuq
*
)
cpi
->
y_dequant_val_nuq
[
dq
][
qindex
];
}
#endif // CONFIG_NEW_QUANT
x
->
plane
[
0
].
quant_thred
[
0
]
=
x
->
plane
[
0
].
zbin
[
0
]
*
x
->
plane
[
0
].
zbin
[
0
];
...
...
@@ -1289,8 +1300,12 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
x
->
plane
[
i
].
round
=
quants
->
uv_round
[
qindex
];
xd
->
plane
[
i
].
dequant
=
cpi
->
uv_dequant
[
qindex
];
#if CONFIG_NEW_QUANT
x
->
plane
[
i
].
cuml_bins_nuq
=
quants
->
uv_cuml_bins_nuq
[
qindex
];
xd
->
plane
[
i
].
dequant_val_nuq
=
cpi
->
uv_dequant_val_nuq
[
qindex
];
for
(
dq
=
0
;
dq
<
QUANT_PROFILES
;
dq
++
)
{
x
->
plane
[
i
].
cuml_bins_nuq
[
dq
]
=
(
cuml_bins_type_nuq
*
)
quants
->
uv_cuml_bins_nuq
[
dq
][
qindex
];
xd
->
plane
[
i
].
dequant_val_nuq
[
dq
]
=
(
const
dequant_val_type_nuq
*
)
cpi
->
uv_dequant_val_nuq
[
dq
][
qindex
];
}
#endif // CONFIG_NEW_QUANT
x
->
plane
[
i
].
quant_thred
[
0
]
=
x
->
plane
[
i
].
zbin
[
0
]
*
x
->
plane
[
i
].
zbin
[
0
];
...
...
vp10/encoder/quantize.h
View file @
cc16c5d8
...
...
@@ -34,10 +34,10 @@ typedef void (*VP10_QUANT_FACADE)(const tran_low_t *coeff_ptr,
typedef
struct
{
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED
(
16
,
tran_low_t
,
y_cuml_bins_nuq
[
QINDEX_RANGE
][
COEF_BANDS
]
y_cuml_bins_nuq
[
QUANT_PROFILES
][
QINDEX_RANGE
][
COEF_BANDS
]
[
NUQ_KNOTS
]);
DECLARE_ALIGNED
(
16
,
tran_low_t
,
uv_cuml_bins_nuq
[
QINDEX_RANGE
][
COEF_BANDS
]
uv_cuml_bins_nuq
[
QUANT_PROFILES
][
QINDEX_RANGE
][
COEF_BANDS
]
[
NUQ_KNOTS
]);
#endif // CONFIG_NEW_QUANT
// 0: dc 1: ac 2-8: ac repeated to SIMD width
...
...
vp10/encoder/rd.c
View file @
cc16c5d8
...
...
@@ -582,11 +582,10 @@ void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n_log2,
}
}
void
vp10_get_entropy_contexts
(
BLOCK_SIZE
bsize
,
TX_SIZE
tx_size
,
const
struct
macroblockd_plane
*
pd
,
ENTROPY_CONTEXT
t_above
[
2
*
MAX_MIB_SIZE
],
ENTROPY_CONTEXT
t_left
[
2
*
MAX_MIB_SIZE
])
{
const
BLOCK_SIZE
plane_bsize
=
get_plane_block_size
(
bsize
,
pd
);
void
vp10_get_entropy_contexts_plane
(
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
,
const
struct
macroblockd_plane
*
pd
,
ENTROPY_CONTEXT
t_above
[
2
*
MAX_MIB_SIZE
],
ENTROPY_CONTEXT
t_left
[
2
*
MAX_MIB_SIZE
])
{
const
int
num_4x4_w
=
num_4x4_blocks_wide_lookup
[
plane_bsize
];
const
int
num_4x4_h
=
num_4x4_blocks_high_lookup
[
plane_bsize
];
const
ENTROPY_CONTEXT
*
const
above
=
pd
->
above_context
;
...
...
@@ -622,6 +621,14 @@ void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
}
}
void
vp10_get_entropy_contexts
(
BLOCK_SIZE
bsize
,
TX_SIZE
tx_size
,
const
struct
macroblockd_plane
*
pd
,
ENTROPY_CONTEXT
t_above
[
2
*
MAX_MIB_SIZE
],
ENTROPY_CONTEXT
t_left
[
2
*
MAX_MIB_SIZE
])
{
const
BLOCK_SIZE
plane_bsize
=
get_plane_block_size
(
bsize
,
pd
);
vp10_get_entropy_contexts_plane
(
plane_bsize
,
tx_size
,
pd
,
t_above
,
t_left
);
}
void
vp10_mv_pred
(
VP10_COMP
*
cpi
,
MACROBLOCK
*
x
,
uint8_t
*
ref_y_buffer
,
int
ref_y_stride
,
int
ref_frame
,
BLOCK_SIZE
block_size
)
{
...
...
vp10/encoder/rdopt.c
View file @
cc16c5d8
...
...
@@ -1188,6 +1188,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
#if CONFIG_NEW_QUANT
int ctx;
struct macroblockd_plane *const pd = &xd->plane[plane];
#endif // CONFIG_NEW_QUANT
int64_t rd1, rd2, rd;
int rate;
int64_t dist;
...
...
@@ -1195,12 +1199,18 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
ENTROPY_CONTEXT coeff_ctx = combine_entropy_contexts(
*(args->t_above + blk_col), *(args->t_left + blk_row));
#if CONFIG_NEW_QUANT
ctx = get_entropy_context(tx_size, pd->above_context + blk_col,
pd->left_context + blk_row);
#endif // CONFIG_NEW_QUANT
if (args->exit_early)
return;
if (!is_inter_block(mbmi)) {
struct encode_b_args intra_arg = {x, NULL, &mbmi->skip, args->t_above,
args->t_left};
vp10_encode_block_intra(plane, block, blk_row, blk_col,
plane_bsize, tx_size, &intra_arg);
...
...
@@ -1243,7 +1253,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
// full forward transform and quantization
#if CONFIG_NEW_QUANT
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size
, ctx
);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_FP);
...
...
@@ -1260,10 +1270,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
#if CONFIG_NEW_QUANT
if (x->quant_fp)
vp10_xform_quant_dc_fp_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size
, ctx
);
else
vp10_xform_quant_dc_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size
, ctx
);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_DC);
...
...
@@ -1296,10 +1306,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
#if CONFIG_NEW_QUANT
if (x->quant_fp)
vp10_xform_quant_fp_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size
, ctx
);
else
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size
, ctx
);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
VP10_XFORM_QUANT_FP);
...
...
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