Граф коммитов

106 Коммитов

Автор SHA1 Сообщение Дата
Timothy Nikkel 694b21a43d Bug 1788866. Fix pixel format type for color management of avif images. r=gfx-reviewers,lsalzman
This code was copied from the png decoder but it is only applicable to the png decoder because it produces output in rgb order. Whereas the avif decoder produces data in BGR order.

Differential Revision: https://phabricator.services.mozilla.com/D220088
2024-10-15 12:01:28 +00:00
Tamas Szentpeteri 8fd336e783 Backed out changeset fbd927642d73 (bug 1788866) for causing gtest failures related to ImageFrameAnimator.BlendAVIFWithFilter. CLOSED TREE 2024-10-10 10:11:39 +03:00
Timothy Nikkel 5a7954ec49 Bug 1788866. Fix pixel format type for color management of avif images. r=gfx-reviewers,lsalzman
This code was copied from the png decoder but it is only applicable to the png decoder because it produces output in rgb order. Whereas the avif decoder produces data in BGR order.

Differential Revision: https://phabricator.services.mozilla.com/D220088
2024-10-10 05:16:30 +00:00
Chris H-C 84aa2d26d5 Bug 1920562 - Switch all legacy events to default to enabled r=florian,janerik,devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D223831
2024-10-08 20:14:41 +00:00
Sandor Molnar fc1cd91320 Backed out 5 changesets (bug 1920562) for causing xpc assertion failures. CLOSED TREE
Backed out changeset 8f085ab589a8 (bug 1920562)
Backed out changeset 4405387ae770 (bug 1920562)
Backed out changeset a68fd13a33ae (bug 1920562)
Backed out changeset cd3672fc08ed (bug 1920562)
Backed out changeset 62ab18879eea (bug 1920562)
2024-10-08 00:16:13 +03:00
Chris H-C a9c0e218bb Bug 1920562 - Switch all legacy events to default to enabled r=florian,janerik,devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D223831
2024-10-07 17:29:56 +00:00
Chris H-C c02f02fdf0 Bug 1918226 - Use Glean APIs for avif.dav1d_get_picture#return_value r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D221494
2024-09-20 18:43:03 +00:00
Timothy Nikkel 2a8ea92054 Bug 1846055. Fix color management of grayscale avif files. r=gfx-reviewers,lsalzman
Color management is usually handled in the SurfacePipe, but SurfacePipe is RGB(A) only, and qcms can only operator on grayscale images in grayscale format, not RGB(A). So we must handle the qcms operation in the decoder. This is the same as how the png decoder handles this same situation. One additional wrinkle is that gfx::ConvertYCbCrToRGB32 only outputs RGB even for grayscale input data so we have to create an intermediate grayscale copy of the data for qcms to work on.

Recording command lines here that were used to create the test in case it needs to be modified or extended in the future.

Convert png to grayscale or grayscale + alpha

ffmpeg -i file.png -pix_fmt gray file-gray.png
ffmpeg -i file.png -pix_fmt ya8 file-gray.png

Extract icc profile from png

exiftool -icc_profile -b -w icc file.png

Add icc profile to png

exiftool "-icc_profile<=profile.icc" file.png

Encode avif using provided icc profile in file

avifenc --icc profile.icc input.png output.avif

Differential Revision: https://phabricator.services.mozilla.com/D220101
2024-09-09 09:39:12 +00:00
Timothy Nikkel ae74e50baf Bug 1915543. Do color management on avifs on non-premultiplied alpha image data. r=gfx-reviewers,lsalzman
ConvertYCbCrToRGB32 was doing the premultiplied conversion, which happens before the surface pipe, which is where color management happens.

Differential Revision: https://phabricator.services.mozilla.com/D220517
2024-09-07 21:43:05 +00:00
Timothy Nikkel d76e069654 Bug 1910211. Error-out if an avif file specifies color space options that are not supported instead of asserting. r=gfx-reviewers,nical
The matrix coefficients field in the file is Identity, indicating this is RGB data, but the pixel layout field is "half width and half height". We don't support subsampling with RGB data, so we hit this

https://searchfox.org/mozilla-central/rev/fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/gfx/ycbcr/yuv_convert.cpp#144

which makes ConvertYCbCrToRGB32 fail.

Differential Revision: https://phabricator.services.mozilla.com/D217906
2024-08-07 12:33:34 +00:00
Chun-Min Chang 6b09aea19f Bug 1907121 - Move YCbCrUtils API assertions to caller side r=gfx-reviewers,nical
Initially, the YCbCrUtils and yuv_convert APIs asserted success
internally. With recent changes, those assertions were removed. This
patch reintroduces those assertions on the caller's side instead, except
the `ConvertToRGBA` in ImageConversion.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D216191
2024-07-18 21:02:33 +00:00
Chun-Min Chang 62a44d9679 Bug 1906720 - Simplify nsAVIFDecoder by using ConvertYCbCrToRGB32 exclusively r=gfx-reviewers,nical
This patch simplifies the code path in `nsAVIFDecoder`. Previously,
`nsAVIFDecoder` relied on both `ConvertYCbCrToRGB` and
`ConvertYCbCrToRGB32` to convert YUV data to BGRX or BGRA, depending on
the presence of an alpha channel. With recent changes, `nsAVIFDecoder`
can now use `ConvertYCbCrToRGB32` exclusively to streamline the
conversion process.

Depends on D215985

Differential Revision: https://phabricator.services.mozilla.com/D216228
2024-07-12 21:45:19 +00:00
Chun-Min Chang b7d05ecda0 Bug 1906720 - Replace ConvertYCbCrAToARGB with ConvertYCbCrToRGB32 in nsAVIFDecoder r=gfx-reviewers,nical
This patch replaces `ConvertYCbCrAToARGB` with `ConvertYCbCrToRGB32` in
`nsAVIFDecoder`, as image scaling is not required.

Differential Revision: https://phabricator.services.mozilla.com/D215985
2024-07-12 21:45:18 +00:00
Ting-Yu Lin 9ad26d34a9 Bug 1906716 - Remove MaybeIntSize that is used by only one caller. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D215947
2024-07-08 20:38:03 +00:00
Andrew Osmond fa360dba1b Bug 1901076 - Part 2. Expose frame count variant of metadata decoders. r=tnikkel
It is useful/necessary for WebCodecs image decoding support to be able
to calculate a frame count for the encoded image without actually
decoding every frame. It needs to be able to provide results without the
complete buffer as well.

Differential Revision: https://phabricator.services.mozilla.com/D212831
2024-06-24 22:44:30 +00:00
Andrew Osmond cd691461e5 Bug 1901076 - Part 1. Include animated images loop count in metadata decoding results. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212830
2024-06-24 22:44:30 +00:00
Sandor Molnar 5b0ee75cfc Backed out 2 changesets (bug 1901076) for causing assertion failures @ image/RasterImage.cpp CLOSED TREE
Backed out changeset de52938146cd (bug 1901076)
Backed out changeset 79fece25d231 (bug 1901076)
2024-06-24 23:19:52 +03:00
Andrew Osmond 6fa0ded86a Bug 1901076 - Part 2. Expose frame count variant of metadata decoders. r=tnikkel
It is useful/necessary for WebCodecs image decoding support to be able
to calculate a frame count for the encoded image without actually
decoding every frame. It needs to be able to provide results without the
complete buffer as well.

Differential Revision: https://phabricator.services.mozilla.com/D212831
2024-06-24 17:59:49 +00:00
Andrew Osmond ae67966c25 Bug 1901076 - Part 1. Include animated images loop count in metadata decoding results. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212830
2024-06-24 17:59:48 +00:00
Perry McManis 1ebc673e72 Bug 1877840 - Migrate GVST metrics in the avif namespace to pure glean r=chutten,tnikkel
GVST is how these probes sent data in Fenix and is now unnecessary (and doesn't send data in Fenix release) since Firefox Desktop has direct access to Glean. We therefore need to clean them up in some capacity.

Following the recommendations from the GeckoView Streaming (GVST) validation effort, this is a pure Glean api implementation of the metrics that fell under network in geckoview streaming.

Because these were all categorical histograms, to retain previous functionality we've added parallel instrumentation in Glean.

Differential Revision: https://phabricator.services.mozilla.com/D201024
2024-02-09 19:47:46 +00:00
Paul Adenot d6181b64f8 Bug 1868615 - Remove define usage. r=chunmin
It doesn't exist anymore in upstream libaom, and we're only using it for this
assertion.

Differential Revision: https://phabricator.services.mozilla.com/D198364
2024-01-19 10:35:19 +00:00
Andrew Osmond 0d3eae78e5 Bug 1872536 - Use MakeUniqueFallible for large buffers in image decoders/encoders. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197461
2023-12-31 22:16:46 +00:00
Paul Adenot fcf35cd837 Bug 1869332 - Move libaom to libgkcodecs. r=glandium,media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D196058
2023-12-20 02:32:34 +00:00
Narcis Beleuzu 0f250fb8c2 Backed out 7 changesets (bug 1869332) for Android bustages. CLOSED TREE
Backed out changeset e1a7852ec85a (bug 1869332)
Backed out changeset 886e59d6495f (bug 1869332)
Backed out changeset 03ac3598f84f (bug 1869332)
Backed out changeset 5e775f2c2b9c (bug 1869332)
Backed out changeset 295a1e1f01d5 (bug 1869332)
Backed out changeset 2909ac6aeb41 (bug 1869332)
Backed out changeset dfab47873174 (bug 1869332)
2023-12-19 18:52:01 +02:00
Paul Adenot e2e68cab50 Bug 1869332 - Move libaom to libgkcodecs. r=glandium,media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D196058
2023-12-19 15:21:50 +00:00
Noemi Erli 862354d813 Backed out 7 changesets (bug 1869332) for causing libavcodec related bustages CLOSED TREE
Backed out changeset 1c0fd259312d (bug 1869332)
Backed out changeset d51eba30a225 (bug 1869332)
Backed out changeset 483d3f275da7 (bug 1869332)
Backed out changeset c401449274b4 (bug 1869332)
Backed out changeset c83313202040 (bug 1869332)
Backed out changeset 00ceb6e47715 (bug 1869332)
Backed out changeset 5acc2f4f12c2 (bug 1869332)
2023-12-14 12:02:45 +02:00
Paul Adenot 039cbc5bda Bug 1869332 - Move libaom to libgkcodecs. r=glandium,media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D196058
2023-12-14 09:12:32 +00:00
Stanca Serban d84ca52ee4 Backed out 6 changesets (bug 1869332) for causing build bustages. CLOSED TREE
Backed out changeset 4f8c19f9dfcf (bug 1869332)
Backed out changeset 661e520c2991 (bug 1869332)
Backed out changeset 74e2acabc439 (bug 1869332)
Backed out changeset 1c4b5311ac03 (bug 1869332)
Backed out changeset af22bc552759 (bug 1869332)
Backed out changeset f557e130d997 (bug 1869332)
2023-12-13 18:13:24 +02:00
Paul Adenot 9b4c4a5bb9 Bug 1869332 - Move libaom to libgkcodecs. r=glandium,media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D196058
2023-12-13 13:46:39 +00:00
Timothy Nikkel 01da45e0d3 Bug 1848717. Check that an avif has primary image data too. r=Zaggy1024
Differential Revision: https://phabricator.services.mozilla.com/D190456
2023-10-10 23:06:10 +00:00
Otto Länd 43499f6fab Bug 1703812, 1817997, 1821362: apply code formatting via Lando
# ignore-this-changeset
2023-05-24 13:28:38 +00:00
Paul Adenot a9bfcf37e3 Bug 1817997 - Update nsAVIFDecoder to use the new mp4parse-rust time units. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D176048
2023-05-24 13:18:44 +00:00
Paul Adenot 20b2262251 Bug 1817997 - Adjust code to take advantage of the new TimeUnit API. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D171256
2023-05-24 13:18:39 +00:00
Cosmin Sabou 5fd965f028 Backed out 80 changesets (bug 1821362, bug 1703812, bug 1817997) for causing media crashes as in Bug 1833890. a=backout
Backed out changeset f2113c9b661f (bug 1817997)
Backed out changeset f1ecfbba7ed2 (bug 1703812)
Backed out changeset 011cece33b0d (bug 1817997)
Backed out changeset 4b42659090f3 (bug 1817997)
Backed out changeset 2d92f903dd66 (bug 1817997)
Backed out changeset 0ef13d357ee3 (bug 1817997)
Backed out changeset 7353f869efd2 (bug 1703812)
Backed out changeset 14b061d0f595 (bug 1817997)
Backed out changeset d29bc29397c8 (bug 1703812)
Backed out changeset 54c3294f0839 (bug 1817997)
Backed out changeset b9f2e1155bd7 (bug 1817997)
Backed out changeset d5d5d390dcbf (bug 1817997)
Backed out changeset 8fca27bd0f6b (bug 1817997)
Backed out changeset 670c599a3b99 (bug 1817997)
Backed out changeset deea3077f762 (bug 1817997)
Backed out changeset 25ecea0f3d49 (bug 1817997)
Backed out changeset 35ab3ed5e3fc (bug 1817997)
Backed out changeset f516a428ba32 (bug 1817997)
Backed out changeset e589b4d30995 (bug 1817997)
Backed out changeset d096b9cc905d (bug 1817997)
Backed out changeset 2952a6fa06e5 (bug 1817997)
Backed out changeset c1ac4c31ad9a (bug 1817997)
Backed out changeset 04c60cd83c5f (bug 1821362)
Backed out changeset 6dd80575e551 (bug 1821362)
Backed out changeset b86b569ecd46 (bug 1817997)
Backed out changeset 412e0a9ec4e8 (bug 1817997)
Backed out changeset 8e0dcf163138 (bug 1817997)
Backed out changeset 7af506896930 (bug 1817997)
Backed out changeset 29f7cd2b341c (bug 1817997)
Backed out changeset 7f64e65d9497 (bug 1817997)
Backed out changeset 89c241451a32 (bug 1817997)
Backed out changeset 66e4a26e1ebe (bug 1817997)
Backed out changeset ea1aebd4e245 (bug 1817997)
Backed out changeset 2d88a5915db9 (bug 1817997)
Backed out changeset 697ec1928f9c (bug 1817997)
Backed out changeset 41c0bd1133c5 (bug 1817997)
Backed out changeset b20cc750c020 (bug 1817997)
Backed out changeset dc5fd84a3a4c (bug 1703812)
Backed out changeset efa6d130d4eb (bug 1703812)
Backed out changeset 20d9b7cf0ddc (bug 1703812)
Backed out changeset e77c61e8fad2 (bug 1703812)
Backed out changeset 582d5c680e5a (bug 1703812)
Backed out changeset 96c9aacc6811 (bug 1703812)
Backed out changeset 56ec4a57a6a6 (bug 1703812)
Backed out changeset 8f96c8811675 (bug 1703812)
Backed out changeset a79a2f1b2b51 (bug 1703812)
Backed out changeset 07eb8b2c5b9f (bug 1703812)
Backed out changeset bae2b2fb9759 (bug 1703812)
Backed out changeset 38b0416538f3 (bug 1703812)
Backed out changeset b27b54c95cf2 (bug 1703812)
Backed out changeset cab00065d83d (bug 1703812)
Backed out changeset ab44727b2e1a (bug 1703812)
Backed out changeset b7fdcb494670 (bug 1703812)
Backed out changeset 73db43d49c6d (bug 1703812)
Backed out changeset ce754dbfb862 (bug 1703812)
Backed out changeset d694726a3ee6 (bug 1703812)
Backed out changeset 6acede55acbb (bug 1703812)
Backed out changeset 86e7d4784a20 (bug 1703812)
Backed out changeset 6b2e055d9314 (bug 1703812)
Backed out changeset b08695e5728a (bug 1703812)
Backed out changeset 3b8a0081fd10 (bug 1703812)
Backed out changeset 3a163596f982 (bug 1703812)
Backed out changeset 5be1d4b282ab (bug 1703812)
Backed out changeset 1ce012d7509e (bug 1703812)
Backed out changeset ee2fab5881c7 (bug 1703812)
Backed out changeset 62941a522893 (bug 1703812)
Backed out changeset d4f11dc33eed (bug 1703812)
Backed out changeset 781bb4c3cc02 (bug 1703812)
Backed out changeset f070e0de0566 (bug 1703812)
Backed out changeset 9f65c67ba2a6 (bug 1703812)
Backed out changeset 1e76eecb85e2 (bug 1703812)
Backed out changeset 953432408a83 (bug 1703812)
Backed out changeset fd1dc92d3911 (bug 1703812)
Backed out changeset 34d56948c6b6 (bug 1703812)
Backed out changeset 2ba7ca61ecc3 (bug 1703812)
Backed out changeset 545253c469e6 (bug 1703812)
Backed out changeset fb4a61ab1300 (bug 1703812)
Backed out changeset bf07b3cfd3d5 (bug 1703812)
Backed out changeset eaff51e7754b (bug 1703812)
Backed out changeset f5c485c41d13 (bug 1703812)
2023-05-19 14:49:57 +03:00
Otto Länd 73f06050fb Bug 1703812, 1817997, 1821362: apply code formatting via Lando
# ignore-this-changeset
2023-05-17 16:00:46 +00:00
Paul Adenot 9925667f68 Bug 1817997 - Update nsAVIFDecoder to use the new mp4parse-rust time units. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D176048
2023-05-17 15:47:08 +00:00
Paul Adenot 0aeade5787 Bug 1817997 - Adjust code to take advantage of the new TimeUnit API. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D171256
2023-05-17 15:47:03 +00:00
Timothy Nikkel 9d0226a146 Bug 1823375. Fix all variable shadowing warnings in imagelib. r=Zaggy1024,gfx-reviewers,nical
We can't actually enable the warning because there are some warnings generated by includes coming from outside of imagelib.

Note that change in AOMDecoder::Init is actually a behaviour change: the new behaviour is to return the error code if we fail to decode the alpha image. This matches what we do for the dav1d decoder.

Depends on D173000

Differential Revision: https://phabricator.services.mozilla.com/D173001
2023-04-11 08:06:29 +00:00
Timothy Nikkel 3fb8b06877 Bug 1818725. Don't ignore the return value of nsAVIFDecoder::CreateDecoder. r=Zaggy1024
And also make it return a better result when mDecoder already exists, Complete is not what we want to return.

Depends on D172994

Differential Revision: https://phabricator.services.mozilla.com/D172998
2023-03-23 03:39:06 +00:00
Timothy Nikkel c869e31d5e Bug 1818724. Rename nsAVIFDecoder::Decode. r=Zaggy1024
Because it has the same name as the base class function Decoder::Decode but different arguments, which is confusing.

Depends on D172998

Differential Revision: https://phabricator.services.mozilla.com/D173000
2023-03-20 23:46:50 +00:00
Timothy Nikkel 2c69c06d89 Bug 1813562. Fix leak with color profile and transform in avif decoder. r=Zaggy1024
We run this code for every frame of animated images, so we need to make the code handle that.

Differential Revision: https://phabricator.services.mozilla.com/D172994
2023-03-20 22:49:39 +00:00
zaggy1024 ef5aaf44a9 Bug 1813466 - Store AVIF prefs as default decoder flags in RasterImage. r=tnikkel
This prevents a crash that would occur if a redecode of an animated AVIF happened after changing the `sequences.enabled` pref from `true` to `false`.

Differential Revision: https://phabricator.services.mozilla.com/D170190
2023-03-17 00:50:07 +00:00
zaggy1024 e349b686f8 Bug 1817108 - Check that AVIF frame sizes remain unchanged during animation. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D170193
2023-03-01 07:04:31 +00:00
zaggy1024 0c11da1fd0 Bug 1814708 - Error when the length of AVIF color or alpha sequences mismatch. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D168777
2023-02-07 07:35:32 +00:00
zaggy1024 a55a629ec0 Bug 1814561 - Error out when samples fail to be read from an AVIF sequence. r=tnikkel
The iterator used to read from an AVIF sample index will return `true` from
`HasNext()` even if the next sample is incomplete. We should error completely
out of the decode when this happens, so that we are always guaranteed to have a
sample to decode when there is no error in the parser.

Differential Revision: https://phabricator.services.mozilla.com/D168643
2023-02-07 07:28:55 +00:00
zaggy1024 5117018c2f Bug 1814553 - Make sure to always send AVIF decoder error telemetry. r=tnikkel
This fixes an assertion failure due to the assumption before Bug 1682662 that
all metadata decodes will completely decode a sample. That is no longer the case
because telemetry for image sizes can be sent without a full decode.

Differential Revision: https://phabricator.services.mozilla.com/D168645
2023-02-07 06:34:57 +00:00
zaggy1024 2697cbe267 Bug 1814677 - Use the decoded image size for SurfacePipe frame rectangle. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D168773
2023-02-07 05:55:17 +00:00
zaggy1024 3fcaa79602 Bug 1814741 - Store AVIFDecoderStream in a RefPtr. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D168793
2023-02-06 02:13:37 +00:00
zaggy1024 8f9447e7ed Bug 1814774 - Error early when a different-sized AVIF alpha plane is decoded. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D168892
2023-02-04 13:17:22 +00:00
zaggy1024 e5729af5b8 Bug 1810613 - Part 2 - Apply loop counts from AVIF animation files. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D168345
2023-02-01 09:45:41 +00:00