166 Commits

Author SHA1 Message Date
Ian Baker
fab134f0b3 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
2023-04-26 15:53:58 +01:00
huangdarwin
324115f6cf Effects: Allow BT2020 colors with SDR transfers
Previously, I assumed that SDR contents must be BT709, and HDR contents must be
BT2020. Turns out BT2020 is just wide-gamut, and SDR contents / transfers may be
represented in BT2020 color spaces.

Relax the check, so that we don't throw when valid BT2020 SMPTE 170M contents
are input into effects.

PiperOrigin-RevId: 526668347
2023-04-26 15:41:33 +01:00
sheenachhabra
b11dd106ae Replace MediaFormat with Format class in muxer module
PiperOrigin-RevId: 526655859
2023-04-26 15:40:40 +01:00
peng bin
114020c2d8 Fix previousNumDeltaPocs in skipShortTermRefPicSets 2023-04-25 09:15:25 +01:00
Ian Baker
75d81c7630 Derive previousNumDeltaPocs from numNegativePics and numPositivePics
This more closely matches the equations in equations 7-61 and 7-62 in
See H.265/HEVC (2014) section 7.4.8.
2023-04-25 09:15:25 +01:00
peng bin
bc0dc01a69 Add a test sample for ts+h265 2023-04-25 09:15:25 +01:00
rohks
8a73d8d3fe Add support to fetch ColorInfo from avcC box in AtomParsers
#minor-release

PiperOrigin-RevId: 526082823
2023-04-24 11:37:55 +01:00
sheenachhabra
546b25bbc9 Set default value 0 for compressorname
PiperOrigin-RevId: 525734520
2023-04-24 11:24:48 +01:00
sheenachhabra
3b9ee1c1a1 Add NAL unit start code in csd0/csd1 test data
The actual csd data contains NAL units so it should always start with
a NAL unit start code (00 00 00 01).
This issue was not caught before because in the code there was no
validation to check whether its a valid NAL unit.

PiperOrigin-RevId: 524849867
2023-04-17 17:21:32 +01:00
huangdarwin
acdb7ee921 HDR: Add HDR pixel tests.
Implement HDR input support for texture output, and add HDR pixel tests.

PiperOrigin-RevId: 523417701
2023-04-12 16:51:51 +01:00
andrewlewis
d43fe3470f Fix audio encode timestamp off by one
Simplify the audio encoder input timestamp calculation. The new calculation
avoids drifting by tracking the total number of bytes encoded rather than
tracking the timestamp and remainder separately, and also makes the timestamps
match the decoder output buffer timestamps.

Also switch one of the export tests that was passing through AMR samples over
to using WAVE audio. The problem with using AMR is that the compressed samples
are not necessarily an integer number of audio frames and the shadow decoder
would pass them from input to output, so the audio encoder was receiving
non-integer numbers of audio frames.

Tested by logging the timestamps at the decoder output and encoder input with
forcing transcoding audio, and verifying that after this change the audio
timestamps are no longer off by one.

PiperOrigin-RevId: 523409869
2023-04-12 16:50:25 +01:00
sheenachhabra
b219be0fdd Remove edit box functionality from Mp4Muxer
PiperOrigin-RevId: 521731485
2023-04-05 15:44:04 +01:00
kimvde
0bfe43866a Add test for clipped media items concatenation
This was broken and has been fixed in <unknown commit>.

PiperOrigin-RevId: 521380415
2023-04-05 15:40:09 +01:00
sheenachhabra
bf2d311bf1 Remove adjustable ftyp functionality from Mp4Muxer
PiperOrigin-RevId: 520886975
2023-04-05 15:37:39 +01:00
ibaker
43ad45dbef Remove all RawCC references from media3
RawCC is a Google-internal subtitle format that is no longer directly
supported by this library (since 4f616d6003).

PiperOrigin-RevId: 520591591
2023-03-30 17:25:20 +00:00
sheenachhabra
df46748c6b Add unit test for "elst" box
PiperOrigin-RevId: 519727954
2023-03-30 17:12:52 +00:00
sheenachhabra
35f016f5c4 Add end to end test for edit box
PiperOrigin-RevId: 519184599
2023-03-30 17:10:07 +00:00
sheenachhabra
69cece1d82 Make getMp4LocationData method inline
PiperOrigin-RevId: 518827223
2023-03-30 17:04:46 +00:00
sheenachhabra
0747486e5a Remove helper method to create "hdlr" box for "meta" box
The "hdlr" box for "meta" box can be easily created by passing required parameters to Boxes.hdlr() method.

PiperOrigin-RevId: 518568103
2023-03-30 17:00:53 +00:00
sheenachhabra
e211889d70 Add Mp4 boxes test cases
PiperOrigin-RevId: 518531999
2023-03-30 16:57:33 +00:00
sheenachhabra
87cd90eb15 Fix TODO in Boxes.java
The fix is as per MP4 spec ISO/IEC 14496-12

PiperOrigin-RevId: 518240043
2023-03-21 14:22:08 +00:00
sheenachhabra
669008f437 Use FakeExtractorOutput in Mp4MuxerMetadataTest
The FakeExtractorOutput dumps data in more readable format
so using that where ever possible.

The MdtaMetadataEntry which contains key and value dumped only "key".
Added fix to dump "value" as well.

PiperOrigin-RevId: 517968996
2023-03-21 14:19:12 +00:00
sheenachhabra
ccdbd3b0a3 Add tkhd, mvhd and mdhd box test cases
PiperOrigin-RevId: 517933485
2023-03-21 14:17:47 +00:00
huangdarwin
e54c7a7c79 Test: Trim 4k60 test file to 300ms.
This was trimmed using the Transformer Demo, from ~4 seconds to 300ms

Otherwise, this test file will be quite large, and folks who clone the repo will
have to clone this content as well. Trimming the file also allows the test to
take less time, while still testing the core purpose of the file, to confirm that 4k extraction/decode/GL/encode/muxing works.

PiperOrigin-RevId: 517408463
2023-03-21 14:15:35 +00:00
huangdarwin
a6479c3d10 Test: Move 4k60 test file to local from remote.
This test file used to be remote, which led to various errors in loading the file or timing out during the muxer or overall transformer.

export4k60 test timing on Pixel 7:

|Condition                 |elapsedTimeMs|AS Test "Duration" (s)|
|--------------------------|-------------|----------------------|
|local file (this CL)      |4253         |14                    |
|Remote file, googleguest  |5510         |17                    |
|Remote file, 4G           |11423        |25                    |

PiperOrigin-RevId: 516815462
2023-03-16 15:31:56 +00:00
sheenachhabra
edfef0a879 Add test for Mp4Muxer robustness
With the Mp4Muxer, while writing a large file if the something unexpected happens and muxer is not closed properly then it still outputs a valid MP4 file with partial data.

PiperOrigin-RevId: 516572804
2023-03-16 15:31:03 +00:00
sheenachhabra
40dfe9f07d Add muxer end to end test for av1 video format
PiperOrigin-RevId: 516499906
2023-03-14 15:55:44 +00:00
sheenachhabra
7b8c562d7b Remove setLocation() method from Muxer interface
PiperOrigin-RevId: 516314175
2023-03-14 07:56:52 +00:00
sheenachhabra
7031d2c6f4 Remove sample_h265.mp4 test file
The h265 encoding is getting covered in HDR test case (hdr10-720p.mp4) so having a separate asset is redundant here.

PiperOrigin-RevId: 515347662
2023-03-14 07:49:28 +00:00
sheenachhabra
2f01f9c53b Add support for reading location data in MP4 extractor
The geodata is stored in the "udta" box as per MediaMuxer reference
https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/MPEG4Writer.cpp;drc=master;l=5588

PiperOrigin-RevId: 515095127
2023-03-14 07:46:28 +00:00
samrobinson
3264cb8271 Pass Metadata to Muxer when adding a track.
PiperOrigin-RevId: 514575400
2023-03-07 11:56:53 +00:00
kimvde
0f8b67b875 Make onOutputFormat nullable
- This is to make sure we know about all the tracks before initializing
the SamplePipelines. This allows to set the muxer and the fallback
listener track count before the SamplePipelines are built.
- As a result, the test files had to be updated because the order in
which the tracks are written has changed.
- The ImageAssetLoader also had to be updated to call onOutputFormat
repeatedly until it returns a non-null SampleConsumer.
- Also fix the trackCount sent to the muxer and fallback listener. The
correct track count can be computed now that we know about all the
tracks before building the SamplePipelines.

PiperOrigin-RevId: 514426123
2023-03-07 11:52:52 +00:00
sheenachhabra
a81a5f2699 Create orientation matrix byte array using util method
PiperOrigin-RevId: 514375835
2023-03-07 11:51:13 +00:00
sheenachhabra
f23d6c1dc1 Fix nit issues in muxer end to end tests
Renamed MuxerEndToEndTest.java to Mp4MuxerEndToEndTest.java to align it with class under test.
Removed muxed prefix from dump file name because Mp4 implicitely means muxed only.

PiperOrigin-RevId: 513574681
2023-03-07 11:44:26 +00:00
tofunmi
8ec1f86967 README.md line reflow.
PiperOrigin-RevId: 513289716
2023-03-02 13:23:30 +00:00
tofunmi
e425b6e082 Image frame processing color transfer fix
Used an actual captured image with set color profile for test to minimise the chance of the test flaking. Also renamed the media/bitmap/overlay folder to media/bitmap/input_images for clarity.

PiperOrigin-RevId: 513273353
2023-03-02 13:22:27 +00:00
sheenachhabra
9f51182bb8 Move Mp4MuxerMetadataTest into muxer module
Changes include:
1. Move the test fine into muxer module.
2. Use dump file infra for test cases.
3. Add one additional test for adding float metadata.
4. Few improvements in the code.

In next CL will remove Mp4 term from the file name as we are not using this term in test file names.

PiperOrigin-RevId: 513222506
2023-03-01 17:27:58 +00:00
sheenachhabra
36aa29809d Add Muxer end to end tests
Following test cases are added:
1. Mux H264 video
2. Mux H265 video
3. Mux HDR video

Each test case performs following actions:
1. Extract track and samples from input Mp4 using MediaExtractor.
2. Feed those samples into Mp4 muxer.
3. Use extractor to extract the samples from muxed file and create dump file.

PiperOrigin-RevId: 512589069
2023-02-27 18:50:56 +00:00
huangdarwin
cc1ca860b1 Test: Add format codec info and update HDR10 file to 720p.
Add format codec info, which can make test skipping checks more similar to the
actual Transformer decoder checks.

Also for the test file, the actual format was 720p, but somehow the file name and
media metadata indicated 1080p. This format mismatch led to some decoding errors,
so fix the format (and associated errors). This also allows us to remove the
exception catch in ForceInterpretHdrVideoAsSdrTest, which was included due to
errors from the incorrect format.

PiperOrigin-RevId: 511809507
2023-02-27 18:32:55 +00:00
kimvde
5c54a7dffb Add unit tests for audio track dis(appearing) during export
PiperOrigin-RevId: 511764841
2023-02-27 18:28:14 +00:00
sheenachhabra
2515e39fa2 Move FtypAdjusterTest.java into muxer module
Changes include:
1. Move the test file into muxer module
2. Code improvement
2. Remove dependency from Mp4Slicer library

PiperOrigin-RevId: 511191076
2023-02-27 18:20:48 +00:00
sheenachhabra
85e49fc4e2 Add missing test cases for sample table boxes
Test cases for following boxes are added:
1. stsc
2. co64
3. stss

PiperOrigin-RevId: 511002841
2023-02-27 18:12:57 +00:00
sheenachhabra
a33b0d64c1 Move SampleTableBoxesTest.java into third_party/.../muxer/...
Following changes are included:
1. Move test file into third_party/.../muxer/...
2. Rewrite tests for stts box and stsz box to use dump file infra instead of Mp4Slicer.
3. Remove existing test cases related to stts box which are kind of duplicate as it tries to cover the scenarios which are already covered by "DurationsVuForStts" related test cases.

PiperOrigin-RevId: 510977119
2023-02-27 18:10:23 +00:00
sheenachhabra
f6155557eb Change DumpableBox to dump recursively
PiperOrigin-RevId: 510433206
2023-02-27 17:56:22 +00:00
sheenachhabra
6711a59564 Move BoxesTest.java into muxer module
Following changes are included:
1. Move BoxesTest.java into muxer module.
2. Change test code to use dump file infra.

BoxesTest.java does not cover all the boxes implemented in Boxes.java so created a WI to track it b/269471752

PiperOrigin-RevId: 510219645
2023-02-17 11:54:46 +00:00
huangdarwin
3e2c6797bb Effect: Implement brightness convenience class.
It can be confusing how to use RgbMatrix for app devs not comfortable with image
manipulation, so add a helper class that simply translates rgb values the same
constant brightness value, to update the brightness values.

PiperOrigin-RevId: 509287229
2023-02-13 19:34:34 +00:00
huangdarwin
38dd1489ba Test: Update emulator version from 31 to 33.
For all end-to-end tests, we currently run on a generic API 26 and newer API 31 emulator. Due to some issues on API 31, update to use an API 33 emulator.

Also, update documentation to mention issues on different emulator versions.

PiperOrigin-RevId: 509242743
2023-02-13 17:01:44 +00:00
andrewlewis
5c30165c28 Update overlay test bitmap based on emulator output
PiperOrigin-RevId: 509210836
2023-02-13 14:35:38 +00:00
sheenachhabra
31d04748ef Improve Audio box test and video box test
Following changes are included:
1. Added missing color information in HDR test case.
2. Corrected few namings in AudioBoxesTest.java.
3. Updated corresponding dump files.

PiperOrigin-RevId: 508745206
2023-02-10 21:46:12 +00:00
tofunmi
574424f626 Update frame & texture processors to handle SDR image input
GLEffectsFrameProcessor, MatrixShaderProgram and FinalMatrixShaderProgramWrapper are currently setup to handle the input frames coming from an external input (i.e. a video decoder). Image input is loaded into Bitmap objects at the start of the pipeline, so they are not produced externally. The changes provide a way for the frame processing pipeline to handle this "internal" (i.e. non-external) input.

PiperOrigin-RevId: 508645244
2023-02-10 14:32:07 +00:00