Move SSIM related files to test_util
PiperOrigin-RevId: 543444043
This commit is contained in:
parent
2322462404
commit
8735382590
@ -644,6 +644,12 @@ public final class C {
|
||||
/** Indicates that a buffer should be decoded but not rendered. */
|
||||
@UnstableApi public static final int BUFFER_FLAG_DECODE_ONLY = 1 << 31; // 0x80000000
|
||||
|
||||
/** A realtime {@linkplain MediaFormat#KEY_PRIORITY codec priority}. */
|
||||
@UnstableApi public static final int MEDIA_CODEC_PRIORITY_REALTIME = 0;
|
||||
|
||||
/** A non-realtime (as fast as possible) {@linkplain MediaFormat#KEY_PRIORITY codec priority}. */
|
||||
@UnstableApi public static final int MEDIA_CODEC_PRIORITY_NON_REALTIME = 1;
|
||||
|
||||
/**
|
||||
* Video decoder output modes. Possible modes are {@link #VIDEO_OUTPUT_MODE_NONE}, {@link
|
||||
* #VIDEO_OUTPUT_MODE_YUV} and {@link #VIDEO_OUTPUT_MODE_SURFACE_YUV}.
|
||||
|
@ -16,6 +16,10 @@ apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
|
||||
android {
|
||||
namespace 'androidx.media3.test.utils'
|
||||
|
||||
sourceSets {
|
||||
test.assets.srcDir '../test_data/src/test/assets/'
|
||||
}
|
||||
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.test.utils;
|
||||
|
||||
import static java.lang.Math.pow;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.test.utils;
|
||||
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
@ -24,6 +24,8 @@ import android.content.Context;
|
||||
import android.media.Image;
|
||||
import android.media.MediaCodec;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@ -40,6 +42,8 @@ import java.nio.ByteBuffer;
|
||||
* <p>SSIM is traditionally computed with the luminance channel (Y), this class uses the luma
|
||||
* channel (Y') because the {@linkplain MediaCodec decoder} decodes to luma.
|
||||
*/
|
||||
@UnstableApi
|
||||
@RequiresApi(21)
|
||||
public final class SsimHelper {
|
||||
|
||||
/** The default comparison interval. */
|
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.test.utils;
|
||||
|
||||
import static androidx.media3.common.C.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static androidx.media3.common.util.Assertions.checkState;
|
||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
@ -33,14 +33,18 @@ import android.media.MediaExtractor;
|
||||
import android.media.MediaFormat;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.ConditionVariable;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/** A wrapper for decoding a video using {@link MediaCodec}. */
|
||||
/* package */ final class VideoDecodingWrapper implements AutoCloseable {
|
||||
@UnstableApi
|
||||
@RequiresApi(21)
|
||||
public final class VideoDecodingWrapper implements AutoCloseable {
|
||||
|
||||
private static final int IMAGE_AVAILABLE_TIMEOUT_MS = 10_000;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.test.utils;
|
||||
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
@ -57,14 +57,6 @@ import org.json.JSONObject;
|
||||
public final class AndroidTestUtil {
|
||||
private static final String TAG = "AndroidTestUtil";
|
||||
|
||||
/** A realtime {@linkplain MediaFormat#KEY_PRIORITY encoder priority}. */
|
||||
public static final int MEDIA_CODEC_PRIORITY_REALTIME = 0;
|
||||
|
||||
/**
|
||||
* A non-realtime (as fast as possible) {@linkplain MediaFormat#KEY_PRIORITY encoder priority}.
|
||||
*/
|
||||
public static final int MEDIA_CODEC_PRIORITY_NON_REALTIME = 1;
|
||||
|
||||
/** An {@link Effects} instance that forces video transcoding. */
|
||||
public static final Effects FORCE_TRANSCODE_VIDEO_EFFECTS =
|
||||
new Effects(
|
||||
|
@ -33,6 +33,7 @@ import androidx.media3.common.util.NullableType;
|
||||
import androidx.media3.common.util.SystemClock;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.effect.DebugTraceUtil;
|
||||
import androidx.media3.test.utils.SsimHelper;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -40,6 +40,7 @@ import androidx.media3.effect.Presentation;
|
||||
import androidx.media3.effect.RgbFilter;
|
||||
import androidx.media3.effect.ScaleAndRotateTransformation;
|
||||
import androidx.media3.test.utils.BitmapPixelTestUtil;
|
||||
import androidx.media3.test.utils.VideoDecodingWrapper;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
package androidx.media3.transformer.mh.analysis;
|
||||
|
||||
import static androidx.media3.common.C.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static androidx.media3.common.C.MEDIA_CODEC_PRIORITY_REALTIME;
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_REALTIME;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.recordTestSkipped;
|
||||
|
||||
import android.content.Context;
|
||||
|
Loading…
x
Reference in New Issue
Block a user