mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Adjust SAO mode coding cost for zero offsets.
- Coding zero with TR only takes one bit. - Even though offset 0 should be fairly common, this doesn't seem to help very much and actually increases bdrate on some sequences.
This commit is contained in:
parent
67a3d5542c
commit
9ff32c566c
14
src/sao.c
14
src/sao.c
|
@ -148,9 +148,10 @@ static int sao_mode_bits_edge(int edge_class, int offsets[NUM_SAO_EDGE_CATEGORIE
|
||||||
sao_eo_cat edge_cat;
|
sao_eo_cat edge_cat;
|
||||||
for (edge_cat = SAO_EO_CAT1; edge_cat <= SAO_EO_CAT4; ++edge_cat) {
|
for (edge_cat = SAO_EO_CAT1; edge_cat <= SAO_EO_CAT4; ++edge_cat) {
|
||||||
int abs_offset = abs(offsets[edge_cat]);
|
int abs_offset = abs(offsets[edge_cat]);
|
||||||
mode_bits += 2 + abs_offset;
|
if (abs_offset == 0 || abs_offset == SAO_ABS_OFFSET_MAX) {
|
||||||
if (abs_offset == SAO_ABS_OFFSET_MAX) {
|
mode_bits += abs_offset + 1;
|
||||||
mode_bits -= 1;
|
} else {
|
||||||
|
mode_bits += abs_offset + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,9 +172,10 @@ static int sao_mode_bits_band(int band_position, int offsets[NUM_SAO_EDGE_CATEGO
|
||||||
sao_eo_cat edge_cat;
|
sao_eo_cat edge_cat;
|
||||||
for (edge_cat = SAO_EO_CAT1; edge_cat <= SAO_EO_CAT4; ++edge_cat) {
|
for (edge_cat = SAO_EO_CAT1; edge_cat <= SAO_EO_CAT4; ++edge_cat) {
|
||||||
int abs_offset = abs(offsets[edge_cat]);
|
int abs_offset = abs(offsets[edge_cat]);
|
||||||
mode_bits += 2 + abs_offset;
|
if (abs_offset == 0 || abs_offset == SAO_ABS_OFFSET_MAX) {
|
||||||
if (abs_offset == SAO_ABS_OFFSET_MAX) {
|
mode_bits += abs_offset + 1;
|
||||||
mode_bits -= 1;
|
} else {
|
||||||
|
mode_bits += abs_offset + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue