Enable experimentalRepeatInputBitmapWithoutResampling
Speed up image to video export by default. PiperOrigin-RevId: 657958037
This commit is contained in:
parent
4a99dc4c94
commit
6e678e511b
@ -66,6 +66,8 @@
|
|||||||
scaling. `SurfaceTexture` may include a small scaling that cuts off a
|
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
|
1-texel border around the edge of a cropped buffer. This is now handled
|
||||||
such that output is closer to expected.
|
such that output is closer to expected.
|
||||||
|
* Speed up `DefaultVideoFrameProcessor.queueInputBitmap()`. As a result,
|
||||||
|
exporting images to videos with `Transformer` is faster.
|
||||||
* Muxers:
|
* Muxers:
|
||||||
* IMA extension:
|
* IMA extension:
|
||||||
* Fix bug where clearing the playlist may cause an
|
* Fix bug where clearing the playlist may cause an
|
||||||
|
@ -160,6 +160,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
|||||||
sdrWorkingColorSpace = WORKING_COLOR_SPACE_DEFAULT;
|
sdrWorkingColorSpace = WORKING_COLOR_SPACE_DEFAULT;
|
||||||
requireRegisteringAllInputFrames = true;
|
requireRegisteringAllInputFrames = true;
|
||||||
experimentalAdjustSurfaceTextureTransformationMatrix = true;
|
experimentalAdjustSurfaceTextureTransformationMatrix = true;
|
||||||
|
experimentalRepeatInputBitmapWithoutResampling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Builder(Factory factory) {
|
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
|
* Sets whether {@link BitmapTextureManager} will sample from the input bitmap only once for a
|
||||||
* sequence of output frames.
|
* 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.
|
* resolution input bitmap.
|
||||||
|
*
|
||||||
|
* @deprecated This experimental method will be removed in a future release.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
|
@Deprecated
|
||||||
public Builder setExperimentalRepeatInputBitmapWithoutResampling(
|
public Builder setExperimentalRepeatInputBitmapWithoutResampling(
|
||||||
boolean experimentalRepeatInputBitmapWithoutResampling) {
|
boolean experimentalRepeatInputBitmapWithoutResampling) {
|
||||||
this.experimentalRepeatInputBitmapWithoutResampling =
|
this.experimentalRepeatInputBitmapWithoutResampling =
|
||||||
|
@ -27,7 +27,6 @@ import androidx.media3.common.Format;
|
|||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import androidx.media3.effect.DefaultVideoFrameProcessor;
|
|
||||||
import androidx.media3.effect.Presentation;
|
import androidx.media3.effect.Presentation;
|
||||||
import androidx.media3.transformer.AndroidTestUtil;
|
import androidx.media3.transformer.AndroidTestUtil;
|
||||||
import androidx.media3.transformer.EditedMediaItem;
|
import androidx.media3.transformer.EditedMediaItem;
|
||||||
@ -103,15 +102,8 @@ public class TranscodeSpeedTest {
|
|||||||
testId,
|
testId,
|
||||||
/* inputFormat= */ MP4_LONG_ASSET_WITH_INCREASING_TIMESTAMPS.videoFormat,
|
/* inputFormat= */ MP4_LONG_ASSET_WITH_INCREASING_TIMESTAMPS.videoFormat,
|
||||||
outputFormat);
|
outputFormat);
|
||||||
DefaultVideoFrameProcessor.Factory videoFrameProcessorFactory =
|
|
||||||
new DefaultVideoFrameProcessor.Factory.Builder()
|
|
||||||
.setExperimentalRepeatInputBitmapWithoutResampling(true)
|
|
||||||
.build();
|
|
||||||
Transformer transformer =
|
Transformer transformer =
|
||||||
new Transformer.Builder(context)
|
new Transformer.Builder(context).setVideoMimeType(MimeTypes.VIDEO_H264).build();
|
||||||
.setVideoMimeType(MimeTypes.VIDEO_H264)
|
|
||||||
.setVideoFrameProcessorFactory(videoFrameProcessorFactory)
|
|
||||||
.build();
|
|
||||||
boolean isHighPerformance =
|
boolean isHighPerformance =
|
||||||
Ascii.toLowerCase(Util.MODEL).contains("pixel")
|
Ascii.toLowerCase(Util.MODEL).contains("pixel")
|
||||||
&& (Ascii.toLowerCase(Util.MODEL).contains("6")
|
&& (Ascii.toLowerCase(Util.MODEL).contains("6")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user