22 Commits

Author SHA1 Message Date
hschlueter
f3b80fd54d Add bitmap overlay effect to transformer demo.
The new demo GlFrameProcessor is based on BitmapOverlayVideoProcessor
from the gl-demo. The demo-only GlFrameProcessor can be deleted once
Transformer supports this functionality.

PiperOrigin-RevId: 440059735
2022-04-26 14:15:31 +01:00
hschlueter
f5792dab92 Add periodic dimming effect to transformer demo.
PeriodicDimmingFrameProcessor is an example of how a custom fragment
shader can be used to apply color changes that change over time.

PiperOrigin-RevId: 439840609
2022-04-26 14:08:55 +01:00
hschlueter
c235e4f447 Add matrix provider for AdvancedFrameProcessor and examples in demo.
The matrix provider allows the transformation matrix to be updated
for each frame based on the timestamp.

The following example effects using this were added to the demo:
* a zoom-in transition for the start of the video,
* cropping a rotating rectangular frame portion,
* rotating the frame around the y-axis in 3D.

PiperOrigin-RevId: 439791592
2022-04-26 14:06:36 +01:00
huangdarwin
59f87a5134 Transformer Demo: Disable SDR button for API <31.
This makes it more clear to users of the demo that this is only available under API 31.

PiperOrigin-RevId: 439358674
2022-04-06 11:57:58 +01:00
huangdarwin
f6808c9645 Transformer Demo: Open source previously-internal demo video files.
PiperOrigin-RevId: 439267827
2022-04-06 11:52:58 +01:00
andrewlewis
d2a9419ad3 Add support for requesting color transfer to SDR
From Android T onwards `MediaCodec` supports requesting tone-mapping down to
SDR. Add an option to request this behavior and document that it isn't
supported before T. Also add an option in the demo app to try it out.

Tested manually on a prerelease build.

PiperOrigin-RevId: 437765325
2022-04-06 11:10:06 +01:00
huangdarwin
6858fe9116 Transformer Demo: Add 8k24fps video option.
This can help allow Transformer be more aware of issues in high-res videos.

PiperOrigin-RevId: 437313282
2022-04-06 11:04:52 +01:00
huangdarwin
2a14e3c604 FrameProcessor: Add a ScaleToFitFrameProcessor builder.
This allows us to input scale and rotation in an easier-to-use manner.

PiperOrigin-RevId: 436175982
2022-03-21 12:08:18 +00:00
hschlueter
cf85d1bdc8 Only allow HEVC output MIME selection in demo for API>=24.
The muxer doesn't support HEVC below API 24. The is documented in
the TransformationRequest javadoc and the Transformer.Builder will
throw if HEVC is requested below API 24 so the option should not
be part of the demo for those devices.

#mse-bug-week

PiperOrigin-RevId: 429343805
2022-02-18 14:56:25 +00:00
samrobinson
061aac7ab2 Add new public 4k60 portrait video to the demo application.
#mse-bug-week

PiperOrigin-RevId: 429323642
2022-02-18 14:52:48 +00:00
hschlueter
61354497e3 Add enable fallback option to transformer demo.
Also invert disableFallback parameter in DefaultEncoderFactory
to enableFallback. Fallback is still enabled by default.

PiperOrigin-RevId: 429253266
2022-02-17 14:59:32 +00:00
kimvde
f8d8bfb664 Handle player release timing out in transformer
- The resources were released twice before, which is not necessary since
  the MSG_RELEASE message is already in the internal player queue.
- The demo app was failing because the stop watch was stopped in
  onTransformationError after being reset.

#minor-release
#mse-bug-week

PiperOrigin-RevId: 428794426
2022-02-17 11:52:23 +00:00
huangdarwin
78b461f94c Transformer GL: Update TODOs.
Document some suboptimal things, and remove TODOs that were
fixed already or no longer relevant. Comment-only change.

PiperOrigin-RevId: 428749344
2022-02-17 11:52:23 +00:00
andrewlewis
1afba9676e Fix debug frame showing through player on old devices
PiperOrigin-RevId: 428524300
2022-02-17 10:38:13 +00:00
andrewlewis
6adf2f8c91 Improve transformer activity layout
On Samsung S21 with light theme the debug labels weren't showing up because the player view was visible (with a black background) while the transformation was in progress, matching the debug label text color. Hide the player view until the transformation is complete to fix this.

Also tweak the layout slightly to add space between the card border and the labels.

#mse-bug-week

PiperOrigin-RevId: 428455824
2022-02-17 10:31:56 +00:00
huangdarwin
b5ed01d479 Transformer GL: Implement auto-scaling to preserve input frame.
PiperOrigin-RevId: 427982223
2022-02-17 10:21:59 +00:00
samrobinson
403d92a4d4 Output from the Transformer the average audio & video bitrates.
PiperOrigin-RevId: 426956151
2022-02-08 10:27:15 +00:00
huangdarwin
ab0cbbea47 Transformer Demo: Remove unneeded external storage permission
Tested by confirming transformations still work and write to a output file in a
scoped-storage directory on a:
* Nexus 6P API 23 emulator
* Google Pixel 4 API 31 physical device

PiperOrigin-RevId: 425644266
2022-02-01 18:23:39 +00:00
hschlueter
aec92606a8 Make transformer demo configuration options scrollable.
On devices with a smaller screen / low resolution not all
options fit, so scrolling is needed.

PiperOrigin-RevId: 425635224
2022-02-01 18:22:27 +00:00
andrewlewis
dd83eca7d4 Add support for experimenting with HDR
- Add a checkbox in the demo app to enable experimental HDR editing.
- Add an `experimental_` method to `TransformationRequest` to enable HDR editing.
- Add fragment/vertex shaders for the experimental HDR pipeline. The main difference compared to the existing shaders is that we sample from the decoder in YUV rather than RGB (because the YUV -> RGB conversion in the graphics driver is not precisely defined, so we need to do this to get consistent results), which requires the use of ES 3, and then do a crude YUV -> RGB conversion in the shader (ignoring the input color primaries for now).
- When HDR editing is enabled, we force using `FrameEditor` (no passthrough) to avoid the need to select another edit operation, and use the new shaders. The `EGLContext` and `EGLSurface` also need to be set up differently for this path.

PiperOrigin-RevId: 425570639
2022-02-01 14:30:16 +00:00
andrewlewis
195d05dabd Switch from valueOf to parse methods
This fixes some warnings that show up in Android Studio (due to using methods
that autobox unnecessarily).

PiperOrigin-RevId: 424892352
2022-02-01 14:08:57 +00:00
andrewlewis
ce4a028829 Publish the transformer demo app
PiperOrigin-RevId: 424850283
2022-01-28 16:48:06 +00:00