1508 Commits

Author SHA1 Message Date
samrobinson
21ad768628 Add AndroidTestUtil missing asset Format info.
Also adds basic support for canDecode receiving an image Format.

PiperOrigin-RevId: 644300521
2024-06-18 02:06:59 -07:00
kimvde
f0aa30555a Remove calls to VideoFrameReleaseControl.join in CompositionPlayer
These calls have no effect because the VideoFrameReleaseControl of
CompositionPlayer is created with allowedJoiningTimeMs set to 0.

PiperOrigin-RevId: 644274524
2024-06-18 00:22:25 -07:00
samrobinson
2698f3ffc2 Migrate performance tests to use AndroidTestUtil constants.
PiperOrigin-RevId: 644058273
2024-06-17 10:38:23 -07:00
samrobinson
2b55a5bc2d Create an AssetInfo class for AndroidTestUtil test asset information.
This is an internal refactor with no logic changed.

There is a duplication in information and a lack of consistency around
the use of test assets in transformer androidTest. This change
refactors each asset to be defined as its own AssetInfo, with the other
relevant parts stored alongside the uri.

Once this is in place, we can consider other useful functionality, such
as having boolean flags for what tracks an asset has, helper methods
for whether an asset is local or remote, and more. This will reduce the
manual overhead necessary to use more assets in tests, and in
particular leads towards easily using new & existing assets in
parameterized tests.

PiperOrigin-RevId: 644040595
2024-06-17 09:47:56 -07:00
samrobinson
6dcbafad21 Use AndroidTestUtil constants so test asset information is consistent.
PiperOrigin-RevId: 643984158
2024-06-17 06:23:22 -07:00
kimvde
eedfb9960e Reset release control from video sink when enabled
PiperOrigin-RevId: 643950097
2024-06-17 03:58:13 -07:00
samrobinson
4109e2edd9 Add more cases for parameterized video android tests.
PiperOrigin-RevId: 643346610
2024-06-14 08:04:13 -07:00
tofunmi
174c49313c support hdr text overlays
adds luminance multiplier to allow the luminance (i.e. brightness) over a text overlay to be scaled

PiperOrigin-RevId: 643047928
2024-06-13 10:41:09 -07:00
samrobinson
e985603e0a Refactor mixedInput E2E test to use parameterized logic.
This CL is a pure refactor of the existing tests, iterative changes
will be done in follow-ups.

The only logic change is having all MP4 assets have the presentaton of
height=360. The old code had some with height 480.
PiperOrigin-RevId: 643020773
2024-06-13 09:17:58 -07:00
claincly
0da892d935 Refactors the seek test and add more test cases
PiperOrigin-RevId: 642597298
2024-06-12 06:34:43 -07:00
claincly
f2bdc08b24 Fix minor timestamp handling issue
- Video release should check for buffer timestamp (which is renderer-offsetted), rather than the frame timestamp
- ImageRenderer should report ended after all of it's outputs are released, rather than when finished consuming its input.

Add tests for timestamp handling

PiperOrigin-RevId: 642587290
2024-06-12 05:43:22 -07:00
kimvde
5a24f40a66 Pass clock to release control from sink provider
In order to do that, make the VideoSink nullable in MCVR.

We want to avoid calling VideoFrameReleaseControl.setClock directly
from MCVR when the sink is enabled. The goal is to handle all the
communication with the release control from the sink/sink provider.

PiperOrigin-RevId: 642542063
2024-06-12 01:51:27 -07:00
sheenachhabra
859ef082d4 Make ExportResult.processedInputs package private
Rational for keeping field package private:
Since the overall export already very complex, by looking at the output file
its hard to know if the desired processing happened or not. Since we now
support sequences with "n" media items, its even more important to know if all
the media items were processed or not.
Although the field exposes implementation details, it seems ok as we get benefit of detailed testing.

PiperOrigin-RevId: 642337888
2024-06-11 11:40:36 -07:00
kimvde
b763673903 Increase sleep duration when video encoder ends with no output frames
This duration was not sufficient on a Pixel 3a

PiperOrigin-RevId: 642276212
2024-06-11 08:21:09 -07:00
samrobinson
06e95ad2fb Reduce flakiness of getProgress tests around percentage values.
There is no requirement for the first progress value to be 0, if
progress is made instantly.

PiperOrigin-RevId: 642245457
2024-06-11 06:14:31 -07:00
claincly
fd376bea07 Add stress test for image transform
PiperOrigin-RevId: 642213253
2024-06-11 03:59:32 -07:00
tofunmi
0d2fdcd025 Add Transformer HDR-only assets sequence effect tests.
PiperOrigin-RevId: 641828107
2024-06-10 02:11:09 -07:00
samrobinson
6bb3af527a Add support for setting and getting volume for composition preview.
PiperOrigin-RevId: 641822822
2024-06-10 01:46:10 -07:00
andrewlewis
3b6175daa7 Fix test names
PiperOrigin-RevId: 641249128
2024-06-07 07:56:30 -07:00
claincly
ea7cfeccb8 Fix timestamps in tests
38a7229d96 changed only some of the timestamps, in fact all
of the timestamps should have the offset removed.

PiperOrigin-RevId: 641226102
2024-06-07 06:04:31 -07:00
claincly
39e572ad6d Fix a concurrency issue that shader capacity is set off GL thread
Also add test to cover transitions between BT709 and 601.

PiperOrigin-RevId: 641224971
2024-06-07 05:59:20 -07:00
claincly
38a7229d96 Unify timestamp handling
Before this change, the timestamps output from composition playback is offset
with the renderer offset. After this change, the offset is removed and the
timestamp behaviour converges with Transformer, that is, the timestamps of
video/images frames will follow that of the composition. For example, with a
composition of two 10-s items, clipping the first with 2s at the start, the
timestamp of the first frame in the second item, will be 8s.

PiperOrigin-RevId: 641121358
2024-06-06 21:36:15 -07:00
sheenachhabra
ec0af5a7e0 Add CodecDetails to ExportException
This will replace the existing free-form string in the error message

PiperOrigin-RevId: 640954158
2024-06-06 11:01:29 -07:00
tofunmi
cd5a638e43 MuxerWrapper: Fix spelling mistake in method name
PiperOrigin-RevId: 640838741
2024-06-06 03:32:19 -07:00
samrobinson
8a02b44c96 Refactor trim optimization getProgress for improved readability.
This change is a no-op refactor to improve the readability of the
states returned in this method.

PiperOrigin-RevId: 640538374
2024-06-05 08:45:02 -07:00
samrobinson
01b860fdc4 Fix invalid state transitions for trim optimization getProgress.
Ensures valid progress state is returned. Should not return NOT_STARTED
once transformer.start has been called, until export ends.

PiperOrigin-RevId: 640533805
2024-06-05 08:30:42 -07:00
kimvde
f54380f9d8 Remove direct usages of release control when video sink is used
Usages removed in this CL are:
- onProcessedStreamChange, which was already called from the VideoSink
  (via VideoFrameRenderControl)
- setOutputSurface, which was also already called from the VideoSink
- setFrameRate, which this CL now sets in the VideoSink

PiperOrigin-RevId: 640530903
2024-06-05 08:19:17 -07:00
kimvde
9716985272 Move renderer state methods from release control to sink
PiperOrigin-RevId: 640515298
2024-06-05 07:16:36 -07:00
sheenachhabra
f3a9c74de2 Remove @UnknownInitialization DefaultCodec parameter
Using an uninitialised object seems unusual.

PiperOrigin-RevId: 640514501
2024-06-05 07:12:20 -07:00
samrobinson
67c19f87a7 Update FILE_UNKNOWN_DURATION to a longer fmp4 (~15s),
Removes the flakiness of
MediaItemExportTest.getProgress_unknownDuration_returnsConsistentStates
by using a longer input asset, such that ExoPlayer does not determine
the duration of the media.

PiperOrigin-RevId: 640502470
2024-06-05 06:19:11 -07:00
dancho
9c4a532d5c Add LanczosResample effect to scale videos in Transformer
Add SeparableConvolution.configure(inputSize) to allow effect configuration
depending on input dimensions.
Add LanczosResample.scaleToFit method to scale input images to fit inside
given dimensions.

PiperOrigin-RevId: 640498008
2024-06-05 06:00:25 -07:00
dancho
5371ad406b Skip AV1 test on devices that don't support AV1 HDR encoding
Skip AV1 HDR test on some devices.

PiperOrigin-RevId: 640135455
2024-06-04 06:44:23 -07:00
samrobinson
2c916dc306 Make progress tests stricter.
These changes are possible because getProgress is no longer a blocking
operation on transformer.

* Tests call getProgress after every looper message executed.
* Use longer media assets for getProgress tests to give more progress
  intervals.
* Remove conditional assertions.

PiperOrigin-RevId: 639734368
2024-06-03 04:42:36 -07:00
dancho
2bb12de00d Drop API requirement from SeparableConvolution
Switch from 4-channel RGBA_16F lookup texture to 1-channel R_16F.
Do not use a bitmap when creating the lookup table texture.
Instead, fill the texture directly.
Do not manually convert 32-bit float to 16-bit. Instead, let OpenGL
libraries do this for us.

PiperOrigin-RevId: 639717235
2024-06-03 03:31:41 -07:00
dancho
d3fa33250b Fix a race condition in AudioGraphInput
AudioGraphInput.onMediaItemChanged is called on input thread. Pending
media item changes are processed on processing thread, inside calls to
getOutput().
This change allows multiple pending media item changes to be enqueued,
and processed in sequence.

PiperOrigin-RevId: 638995291
2024-05-31 04:53:13 -07:00
kimvde
151a2be141 Regenerate TransformerHdrTest goldens after removing degammaing
Degammaing has been removed in cb4b2ea55c. The goldens for
TransformerHdrTest (previously TransformerSequenceEffectTestWithHdr)
were not regenerated because the test wasn't running due to its name
(fixed in e41a966237).

PiperOrigin-RevId: 638645635
2024-05-30 07:32:22 -07:00
kimvde
e41a966237 Rename test so that it runs on MH
PiperOrigin-RevId: 638237657
2024-05-29 04:35:21 -07:00
samrobinson
21eb482baf Add an experimental analyzer mode to Transformer.
PiperOrigin-RevId: 637926059
2024-05-28 09:31:40 -07:00
dancho
3c998ac408 Add a flag to control whether input bitmap resampling can be skipped
Add DefaultVideosFrameProcessor experimental flag that controls
whether input Bitmaps are sampled once for a repeating sequence of
output frames with the same contents, or once for each output frame.

PiperOrigin-RevId: 637921350
2024-05-28 09:15:23 -07:00
dancho
02df88e5d9 Speed up image to video Export
Only sample from input bitmap when the input image has changed.
Introduce GainmapShaderProgram.newImmutableBitmap API that signals
input bitmap changes to GainmapShaderProgram (DefaultShaderProgram).

PiperOrigin-RevId: 637920207
2024-05-28 09:12:24 -07:00
tofunmi
9622411b50 Add support for ultra HDR overlays
PiperOrigin-RevId: 637863706
2024-05-28 05:28:03 -07:00
dancho
aadcbe332b Ensure single-frame videos are correctly exported
Add a wait in DefaultCodec.signalEndOfInputStream when no
video encoder output has been seen. This avoids a thread synchronization problem
between writing frames to video surface, and signaling end of stream,
which was hit for video input of only one frame on some devices.

PiperOrigin-RevId: 637844690
2024-05-28 04:00:01 -07:00
tofunmi
db6144e7dd Maintain a consistent luminance range across HDR content in effects
PQ and HLG have different luminance ranges (max 10k nits and max 1k nits resp). In GL, colors work in a normalised 0 to 1 scale, so for PQ content, 1=10k nits and and for HLG content, 1=1k nits.

This cl scales and normalises PQ content appropriately so that all HDR content works in the HLG luminance range. This fixes two things

1. Conversions between HLG and PQ are "fixed" (before the output colors looked too bright or too dark depending on which way you are converting)
2. color-altering effects will be able to work consistently across HLG and PQ content

1 is tested in this cl. 2 will be tested when ultra HDR overlays are implemented, both cases have been manually tested to ensure the output looks correct on a screen.

PiperOrigin-RevId: 636851701
2024-05-24 03:05:34 -07:00
samrobinson
414dbebc2b Assert file size in E2E android tests that claim to complete.
Remove redundant test logic to add file size to ExportResult because
the file size is already added to export result as part of an export
finishing.

PiperOrigin-RevId: 636499236
2024-05-23 04:17:19 -07:00
dancho
a74076f691 Trigger silence generation when end of stream is encountered
This change avoids a muxer deadlock when:
1. Sequence of items
2. First item has audio track that is shorter than video
3. Audio finishes, and muxer refuses to write more than 500ms of video
   consecutively.

SequenceAssetLoader fails to progress to the second item. A muxer
deadlock is possible when the audio of the first item finishes,
audio end-of-stream is not propagated through AudioGraph, and muxer blocks
video, preventing SequenceAssetLoader to move to the next item in sequence.

By triggering silence generation early as soon as audio EOS is
encountered, we ensure SequenceAssetLoader can progress to the next item.

PiperOrigin-RevId: 636179966
2024-05-22 08:44:28 -07:00
dancho
c2fb2f1520 Work around 1080p export failures on certain devices
Fall back to using software decoder for 1920x1080 for certain
devices.

PiperOrigin-RevId: 636132298
2024-05-22 05:38:50 -07:00
kimvde
72ba3554a9 Set image duration on all media types
This was previously only set on images because it was not ignored on
other media types. This parameter was made no-op for non-images in
7b2a1b4443.

PiperOrigin-RevId: 636078142
2024-05-22 01:41:50 -07:00
kimvde
9506445148 Remove VideoFrameReleaseControl setter from SinkProvider
Move the parameter to the constructor instead.

PiperOrigin-RevId: 636077477
2024-05-22 01:38:56 -07:00
samrobinson
b6ce35d741 Migrate debug trace logs to track generic events for Muxer.
Track information is added to the details string where relevant.

PiperOrigin-RevId: 635815866
2024-05-21 08:33:12 -07:00
samrobinson
8e4d82b012 Assert file exists before trying to re-decode for test assertions.
PiperOrigin-RevId: 635748820
2024-05-21 03:41:48 -07:00