1 /*
2  * Copyright 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.media.videoquality.bdrate;
18 
19 import com.google.auto.value.AutoValue;
20 import com.google.common.base.Preconditions;
21 
22 /**
23  * Single rate-distortion point representing the quality of a given encoded video at a given bitrate
24  * point.
25  */
26 @AutoValue
27 public abstract class RateDistortionPoint {
28 
create(double rate, double distortion)29     public static RateDistortionPoint create(double rate, double distortion) {
30         Preconditions.checkArgument(rate > 0.0, "Bitrate must be a strictly positive value.");
31         return new AutoValue_RateDistortionPoint(rate, distortion);
32     }
33 
34     /** The bitrate (in any scale) of this rate-distortion point. */
rate()35     public abstract double rate();
36 
37     /**
38      * The distortion (in any metric, as long as that metric is monotonically increasing) of this
39      * rate-distortion point.
40      */
distortion()41     public abstract double distortion();
42 }
43