Minor patches in lossless calculation

This commit is contained in:
robo-mop
2023-10-18 10:50:59 +05:30
parent f1f40302fe
commit 3ed34e101c
6 changed files with 5 additions and 7 deletions

View File

@@ -67,7 +67,7 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
break;
}
bool lossless = options.quality == AVIF_QUANTIZER_LOSSLESS &&
bool lossless = options.quality == AVIF_QUALITY_LOSSLESS &&
(options.qualityAlpha == -1 || options.qualityAlpha == AVIF_QUALITY_LOSSLESS) &&
format == AVIF_PIXEL_FORMAT_YUV444;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -63,8 +63,8 @@ export class Options extends Component<Props, State> {
const { options } = props;
const lossless =
options.quality === 0 &&
options.qualityAlpha <= 0 &&
options.quality === MAX_QUALITY &&
(options.qualityAlpha == -1 || options.qualityAlpha == MAX_QUALITY) &&
options.subsample == 3;
const separateAlpha = options.qualityAlpha !== -1;
@@ -77,9 +77,7 @@ export class Options extends Component<Props, State> {
lossless,
quality: quality,
separateAlpha,
alphaQuality: separateAlpha
? options.qualityAlpha
: defaultOptions.quality,
alphaQuality: separateAlpha ? options.qualityAlpha : options.quality,
subsample:
options.subsample === 0 || lossless
? defaultOptions.subsample
@@ -236,7 +234,7 @@ export class Options extends Component<Props, State> {
<div class={style.optionOneCell}>
<Range
min="0"
max="99"
max={MAX_QUALITY - 1} // MAX_QUALITY would mean lossless
value={alphaQuality}
onInput={this._inputChange(
'alphaQuality',