901 Commits

Author SHA1 Message Date
huangdarwin
c122c0ca05 Compositor: Add support for multiple bitmaps, and add testrunner
* Allow more than one input bitmap at a time.
* Allow Compositor to take in and set up an Executor. Otherwise,
Compositor resources may be created on one thread and accessed on another.
* Add a Compositor TestRunner to reuse test code more.
* Update VideoFrameProcessingTaskExecutor to use a new onError listener, so
that it's more reusable in non-DVFP contexts, like for Compositor.

PiperOrigin-RevId: 547206053
2023-07-13 15:45:30 +01:00
samrobinson
4983d4f339 Switch argument order passed to scaleLargeTimestamp.
durationUs is almost always going to be a larger number than the sample
rate, so pass as the main value, rather than the multiplier.

PiperOrigin-RevId: 547193927
2023-07-13 15:44:15 +01:00
andrewlewis
fcadecf2b1 Add note recommending OpenGL tone-mapping
PiperOrigin-RevId: 547192957
2023-07-13 15:43:01 +01:00
andrewlewis
7df09fe4b7 Disable codec tone-mapping on Fold 4 API 33
The codec plugin sets crop values incorrectly.

PiperOrigin-RevId: 547160088
2023-07-13 15:39:21 +01:00
samrobinson
9b06da8174 Remove redundant assertion.
TransformerAndroidTestRunner#run will throw any exception that occurs,
so there is no need to assert the result exception is null.

PiperOrigin-RevId: 546923823
2023-07-13 15:35:50 +01:00
huangdarwin
7c9e6ad2ea Effect: Only allow setExecutorService with @NonNull values.
PiperOrigin-RevId: 546828814
2023-07-13 15:30:07 +01:00
claincly
ddd000128f Add an Input interface to SampleExporter.
PiperOrigin-RevId: 546822962
2023-07-13 15:27:40 +01:00
claincly
9c74e78f33 Revert DefaultCodec to final
The class is made non-final for a test in 12584fbb20.

PiperOrigin-RevId: 546718462
2023-07-13 15:23:07 +01:00
huangdarwin
cd0b45092e Test: Rename bitmap test method from Current to Focused GlFrameBuffer
Frame buffers are focused, not current. EGL Contexts may be current but this
is a prerequisite for focusing a framebuffer, and this alone isn't
sufficient to make a bitmap.

Clear this up as it can make some complex tests harder to understand, if the
methods needed don't match up in naming.

PiperOrigin-RevId: 546305118
2023-07-13 15:15:34 +01:00
andrewlewis
a0bc8d95c2 Improve texture asset loader documentation
Add documentation for threading requirements at the class level (in
addition to existing documentation on the methods) to improve
discoverablility. Also fix a couple of nits in the javadoc (US English
spelling, avoid passive voice) and in `OnInputFrameProcessedListener`.

PiperOrigin-RevId: 546303732
2023-07-13 15:14:21 +01:00
claincly
50c6efe95d Rename SamplePipeline to SampleExporter
PiperOrigin-RevId: 545974776
2023-07-13 15:06:10 +01:00
huangdarwin
99a143a74e Transformer: Add 8k disabling workaround to avoid timeouts.
PiperOrigin-RevId: 545970477
2023-07-13 15:04:59 +01:00
claincly
372cd7f952 Remove unused constructor parameter
PiperOrigin-RevId: 545909062
2023-07-13 15:00:12 +01:00
huangdarwin
7a368b9a11 Effect: Remove GlTextureInfo accessor methods.
The extra check was a bit excessive, especially as it's called multiple times
per frame.

PiperOrigin-RevId: 545657102
2023-07-13 14:51:38 +01:00
huangdarwin
756845426b HDR: Add SM-X900 to HLG10 tone mapping blocklist.
PiperOrigin-RevId: 545647083
2023-07-05 13:59:58 +00:00
huangdarwin
fa781782da Effect: Share ExecutorService and thread between VFP instances.
This allows us to simplify and reduce thread initialization, hops and the
synchronization cost associated with them, especially when more and more VFPs
are used.

PiperOrigin-RevId: 545622169
2023-07-05 13:58:43 +00:00
samrobinson
c33a17d89c Wrap AudioSamplePipeline input and processing within AudioGraph.
This is a no-op refactor.

PiperOrigin-RevId: 545421300
2023-07-05 09:20:12 +00:00
kimvde
8ea79a13f9 Add a TODO to make TransformationRequest.Builder package private
PiperOrigin-RevId: 545400150
2023-07-05 09:19:06 +00:00
kimvde
81c83e4213 Remove HDR modes from TransformationRequest
PiperOrigin-RevId: 545352306
2023-07-05 09:16:52 +00:00
huangdarwin
9945033867 Effect: Create basic VideoCompositor.
Allow two DefaultVideoFrameProcessor instances to output to one
VideoCompositor, which then outputs a frame.

PiperOrigin-RevId: 544705821
2023-07-05 09:02:45 +00:00
tofunmi
d14122b029 Create queue of sync objects in FinalShaderProgramWrapper
PiperOrigin-RevId: 544683524
2023-07-05 09:00:20 +00:00
tofunmi
6f9731ce7e TextureInput: Advise client to delete syncObject after use
PiperOrigin-RevId: 544670927
2023-07-05 08:57:55 +00:00
huangdarwin
a875fa72a8 GL: Move fallback to glFinish to GlUtil.
This may happen, for example, on older OpenGL versions.

This may be used in the compositor too.

PiperOrigin-RevId: 544613566
2023-07-05 08:54:24 +00:00
samrobinson
f60f79bb10 Handle media item (Effects/Format) changes in AudioSamplePipeline.
On a MediaItem change, the input Format (and Effects to apply) may be
different. Therefore the AudioProcessingPipeline must be reconfigured
to determine what processing is active, and what the AudioFormat of the
data output is. In the event that it is different, additional
AudioProcessor instances must be used to ensure the encoder will still
be able to accept the audio buffers.

PiperOrigin-RevId: 544338451
2023-06-29 23:14:10 +00:00
kimvde
32bd5dd718 Fix forceInterpretHdrAsSdr not being set in DefaultAssetLoaderFactory
PiperOrigin-RevId: 544296301
2023-06-29 23:13:00 +00:00
tofunmi
a98b33b03c Replace glFinish in texture output with Gl sync token
Providing the sync token in the api allows the client to decide which waiting method they would like to use depending on the use case, allowing them to optimise if possible.

PiperOrigin-RevId: 543997311
2023-06-29 23:07:56 +00:00
andrewlewis
81fc9ea509 Make DefaultDecoderFactory visible
This fixes a broken javadoc link and makes it possible to customize media
source creation via the asset loader factory without also having to
implementing a decoder factory from scratch.

PiperOrigin-RevId: 543995538
2023-06-29 23:06:47 +00:00
kimvde
a632118875 Remove TransformationRequest.Builder deprecated methods
TransformationRequest.Builder will become package private.

PiperOrigin-RevId: 543987255
2023-06-29 23:03:41 +00:00
tofunmi
8cecb93570 Texture Input: Add GLSyncToken to the OnInputFrameProcessedListener
PiperOrigin-RevId: 543867944
2023-06-29 23:02:20 +00:00
claincly
f98a10f3f2 Move GlShaderProgram creation away from VFP creation
PiperOrigin-RevId: 543773418
2023-06-29 23:00:11 +00:00
kimvde
b358d075a1 Replace usages of deprecated TransformationRequest setter
PiperOrigin-RevId: 543765376
2023-06-29 22:59:06 +00:00
kimvde
f8491fc61f Deprecate Transformer.Builder.setTransformationRequest()
Usages will be removed in follow-up changes.

PiperOrigin-RevId: 543654397
2023-06-29 22:55:29 +00:00
samrobinson
0d67733d28 Update media in silence concatentation test to match silent format.
Goal of tests (SequenceExportTest) that use this media is for the
silence and the media to match exactly with audio format, however
`sample_with_increasing_timestamps.mp4` had a different sample rate.

testvid_1022ms.mp4: channel count = 2, sample rate = 44100.

PiperOrigin-RevId: 543458948
2023-06-29 22:52:32 +00:00
sheenachhabra
8735382590 Move SSIM related files to test_util
PiperOrigin-RevId: 543444043
2023-06-29 22:51:20 +00:00
tonihei
2322462404 Do not trim audio samples by changing their timestamp
MP4 edit lists sometimes ask to start playback between two samples.
If this happens, we currently change the timestamp of the first
sample to zero to trim it (e.g. to display the first frame for a
slightly shorter period of time). However, we can't do this to audio
samples are they have an inherent duration and trimming them this
way is not possible.

#minor-release

PiperOrigin-RevId: 543420218
2023-06-29 22:50:04 +00:00
kimvde
bdd593e0d3 Make FallbackListener.onTransformationRequestFinalized() synchronized
FallbackListener.onTransformationRequestFinalized() is called from the
AssetLoader thread for audio, and from the GL thread for video.

PiperOrigin-RevId: 542851284
2023-06-23 16:50:56 +00:00
claincly
12584fbb20 Add test for force EOS when a decoder drops frames
This is for the timer added in abd96598d9

PiperOrigin-RevId: 542571387
2023-06-23 16:42:46 +00:00
samrobinson
b46b6a8278 Use stereo audio in silence -> audio SequenceExportTest.
With the upcoming "handle format changes" CL, stereo -> mono audio
would add an AudioProcessor. Robolectric decodes output encoded data,
which crashes some AudioProcessors because the number of frames may not
be an integer.

PiperOrigin-RevId: 542568875
2023-06-23 16:40:57 +00:00
kimvde
69cef452a0 Make SpeedChangingAudioProcessor public
PiperOrigin-RevId: 542533743
2023-06-22 15:46:42 +00:00
tofunmi
be38670391 Transformer: Decode image in sRGB
The effects pipeline must receive images in the sRGB colorspace due to the color transfers applied in the shaders. Currently the burden to making sure images are in the right colorspaces falls onto apps. This CL ensures that this is not the case anymore.

PiperOrigin-RevId: 542323613
2023-06-22 15:41:55 +00:00
samrobinson
64f93a895e Assert that Formats passed to ASP represent valid decoded audio.
Ensure SequenceAssetLoader knows downstream is decoding audio if
silence is generated.

PiperOrigin-RevId: 542293633
2023-06-22 15:37:26 +00:00
samrobinson
d2105204e1 Propagate Metadata from extracted Format to decoded Format.
MediaCodec does not retain the `Metadata` of its input `Format`, so
add it to the output `Format`.

PiperOrigin-RevId: 542194322
2023-06-22 15:31:30 +00:00
tofunmi
09fe0d7390 Correct the DefaultFrameDroppingShaderProgram logic
copies the previous texture to a temp texture to ensure the correct frame is queued.

#minor-release

PiperOrigin-RevId: 541972349
2023-06-22 15:29:41 +00:00
claincly
4cb5f38007 Increase pixel difference
PiperOrigin-RevId: 541860433
2023-06-20 14:05:07 +01:00
samrobinson
125c39eec3 Use AudioFormat within SilenceAudioGenerator.
PiperOrigin-RevId: 541856580
2023-06-20 14:04:06 +01:00
samrobinson
74948d5424 Add a constructor for AudioFormat that takes Format.
PiperOrigin-RevId: 541662208
2023-06-20 13:59:47 +01:00
samrobinson
6d648f8bdb Add dump tests for concatenating 2 audio items.
Audio only tests are now using RAW audio where possible, which is
passed through the Robolectric decoders/encoders, and can be handled by
the AudioProcessor instances accurately.

PiperOrigin-RevId: 541648853
2023-06-20 13:57:33 +01:00
huangdarwin
949e9cbd96 GL: Rename GL methods.
To more accurately describe what they do, especially as Compositor will
starts to use more contexts or threads, and it's important to know what
needs to be reset/recreated/focused before what methods.

PiperOrigin-RevId: 541010135
2023-06-19 16:29:03 +01:00
sheenachhabra
c0e8513b7a Make dump files deterministic
Issue: When running the Transformer related test cases, the tests are flaky
because the order in which audio and video samples are interleaved seems to
differ in few instances.

Root cause: When running a transformation the sample producer (Asset loader)
and sample consumer (Sample pipeline) both runs on different thread and
theoretically there is no reason for behaviour to be deterministic because
the number of samples produced/written depends on how fast individual thread
works. So it is indeed surprising that test somehow worked deterministically in
majority of instances (may be something to do with Robolectric environment).

Solution: Since we don't expect the order of sample interleaving to be deterministic, make the dumping logic deterministic where all the video
samples will be collected and then dumped together (similarly for audio). This would mean we won't be able to see the interleaving so for that we need to
add separate test case verifying the interleaving logic only.

Pending: Test case for interleaving.
PiperOrigin-RevId: 540930871
2023-06-19 16:28:07 +01:00
huangdarwin
daa42322d7 GL: Remove configAttributes from createFocusedPlaceholderEglSurface.
PiperOrigin-RevId: 540901189
2023-06-19 16:27:02 +01:00