mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-19 03:59:09 +00:00
Updating AVIF, and 'auto' SSIM option (#1008)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { EncodeOptions, defaultOptions } from '../shared/meta';
|
||||
import { EncodeOptions, defaultOptions, AVIFTune } from '../shared/meta';
|
||||
import type WorkerBridge from 'client/lazy-app/worker-bridge';
|
||||
import { h, Component } from 'preact';
|
||||
import { preventDefault, shallowEqual } from 'client/lazy-app/util';
|
||||
@@ -37,7 +37,7 @@ interface State {
|
||||
sharpness: number;
|
||||
denoiseLevel: number;
|
||||
aqMode: number;
|
||||
tune: 'ssim' | 'psnr';
|
||||
tune: AVIFTune;
|
||||
}
|
||||
|
||||
const maxQuant = 63;
|
||||
@@ -82,7 +82,7 @@ export class Options extends Component<Props, State> {
|
||||
chromaDeltaQ: options.chromaDeltaQ,
|
||||
sharpness: options.sharpness,
|
||||
denoiseLevel: options.denoiseLevel,
|
||||
tune: options.targetSsim ? 'ssim' : 'psnr',
|
||||
tune: options.tune,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ export class Options extends Component<Props, State> {
|
||||
chromaDeltaQ: optionState.chromaDeltaQ,
|
||||
sharpness: optionState.sharpness,
|
||||
denoiseLevel: optionState.denoiseLevel,
|
||||
targetSsim: optionState.tune === 'ssim',
|
||||
tune: optionState.tune,
|
||||
};
|
||||
|
||||
// Updating options, so we don't recalculate in getDerivedStateFromProps.
|
||||
@@ -268,13 +268,14 @@ export class Options extends Component<Props, State> {
|
||||
</Range>
|
||||
</div>
|
||||
<label class={style.optionTextFirst}>
|
||||
Tune for:
|
||||
Tuning:
|
||||
<Select
|
||||
value={tune}
|
||||
onChange={this._inputChange('tune', 'string')}
|
||||
onChange={this._inputChange('tune', 'number')}
|
||||
>
|
||||
<option value="psnr">PSNR</option>
|
||||
<option value="ssim">SSIM</option>
|
||||
<option value={AVIFTune.auto}>Auto</option>
|
||||
<option value={AVIFTune.psnr}>PSNR</option>
|
||||
<option value={AVIFTune.ssim}>SSIM</option>
|
||||
</Select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { EncodeOptions } from 'codecs/avif/enc/avif_enc';
|
||||
import { EncodeOptions, AVIFTune } from 'codecs/avif/enc/avif_enc';
|
||||
|
||||
export { EncodeOptions };
|
||||
export { EncodeOptions, AVIFTune };
|
||||
|
||||
export const label = 'AVIF';
|
||||
export const mimeType = 'image/avif';
|
||||
@@ -27,5 +27,5 @@ export const defaultOptions: EncodeOptions = {
|
||||
subsample: 1,
|
||||
chromaDeltaQ: false,
|
||||
sharpness: 0,
|
||||
targetSsim: false,
|
||||
tune: AVIFTune.auto,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user