Enable experimentalRepeatInputBitmapWithoutResampling

Speed up image to video export by default.

PiperOrigin-RevId: 657958037
This commit is contained in:
dancho 2024-07-31 04:38:05 -07:00 committed by Copybara-Service
parent 4a99dc4c94
commit 6e678e511b
3 changed files with 8 additions and 10 deletions

View File

@ -66,6 +66,8 @@
scaling. `SurfaceTexture` may include a small scaling that cuts off a
1-texel border around the edge of a cropped buffer. This is now handled
such that output is closer to expected.
* Speed up `DefaultVideoFrameProcessor.queueInputBitmap()`. As a result,
exporting images to videos with `Transformer` is faster.
* Muxers:
* IMA extension:
* Fix bug where clearing the playlist may cause an

View File

@ -160,6 +160,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
sdrWorkingColorSpace = WORKING_COLOR_SPACE_DEFAULT;
requireRegisteringAllInputFrames = true;
experimentalAdjustSurfaceTextureTransformationMatrix = true;
experimentalRepeatInputBitmapWithoutResampling = true;
}
private Builder(Factory factory) {
@ -306,10 +307,13 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
* Sets whether {@link BitmapTextureManager} will sample from the input bitmap only once for a
* sequence of output frames.
*
* <p>Defaults to {@code false}. That is, each output frame will sample from the full
* <p>Defaults to {@code true}. That is, each output frame will sample from the full
* resolution input bitmap.
*
* @deprecated This experimental method will be removed in a future release.
*/
@CanIgnoreReturnValue
@Deprecated
public Builder setExperimentalRepeatInputBitmapWithoutResampling(
boolean experimentalRepeatInputBitmapWithoutResampling) {
this.experimentalRepeatInputBitmapWithoutResampling =

View File

@ -27,7 +27,6 @@ import androidx.media3.common.Format;
import androidx.media3.common.MediaItem;
import androidx.media3.common.MimeTypes;
import androidx.media3.common.util.Util;
import androidx.media3.effect.DefaultVideoFrameProcessor;
import androidx.media3.effect.Presentation;
import androidx.media3.transformer.AndroidTestUtil;
import androidx.media3.transformer.EditedMediaItem;
@ -103,15 +102,8 @@ public class TranscodeSpeedTest {
testId,
/* inputFormat= */ MP4_LONG_ASSET_WITH_INCREASING_TIMESTAMPS.videoFormat,
outputFormat);
DefaultVideoFrameProcessor.Factory videoFrameProcessorFactory =
new DefaultVideoFrameProcessor.Factory.Builder()
.setExperimentalRepeatInputBitmapWithoutResampling(true)
.build();
Transformer transformer =
new Transformer.Builder(context)
.setVideoMimeType(MimeTypes.VIDEO_H264)
.setVideoFrameProcessorFactory(videoFrameProcessorFactory)
.build();
new Transformer.Builder(context).setVideoMimeType(MimeTypes.VIDEO_H264).build();
boolean isHighPerformance =
Ascii.toLowerCase(Util.MODEL).contains("pixel")
&& (Ascii.toLowerCase(Util.MODEL).contains("6")