aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
5 daysMerge "Snap for 11926842 from 38a9a33e4645690016f2fe0f1436a970562f9a18 to ↵sdk-releaseAndroid Build Coastguard Worker
sdk-release" into sdk-release
5 daysSnap for 11926842 from 38a9a33e4645690016f2fe0f1436a970562f9a18 to sdk-releaseAndroid Build Coastguard Worker
Change-Id: Idb6a6c1f8ab95e8d31adee041bc2888a9e482dc9
5 daysMerge "Merge tag 'v1.14.1' into aosp/main" into mainHEADmastermainTreehugger Robot
5 daysMerge tag 'v1.14.1' into aosp/mainJames Zern
* commit '12f3a2ac603e8f10742105519e0cd03c3b8f71dd': (38 commits) Update CHANGELOG Update CHANGELOG for fixes to ubsan errors Fix some UBSan errors in vp8_new_framerate() Fix a UBSan error in vp9_rc_update_framerate() Update AUTHOR, version and CHANGELOG Fix a bug in alloc_size for high bit depths Apply stride_align to byte count, not pixel count Avoid wasted calc of stride_in_bytes if !img_data Avoid integer overflows in arithmetic operations Fix integer overflows in calc of stride_in_bytes Add test/vpx_image_test.cc Make img_alloc_helper() fail on VPX_IMG_FMT_NONE Fix error handling in vp9_pack_bitstream() Perform bounds checks in vpx_write_bit_buffer Perform bounds checks in vpx_writer vp9_pack_bitstream: remove a dead store Add the buffer_end field to the vpx_writer struct Pass output buffer size to vp9_pack_bitstream() vp9 rc: Fix GetSegmentationData() crash in aq_mode=0 vp9: Fix to alloc for row_base_thresh_freq_fac ... Bug: webm:1854 Test: presubmit + \ (shiba) atest CtsMediaV2TestCases -- --module-arg \ CtsMediaV2TestCases:instrumentation-arg:codec-filter:="c2\.android\.vp[89]" compile aosp_arm-trunk_staging-eng, \ aosp_arm64-trunk_staging-eng, aosp_riscv64-trunk_staging-eng, \ aosp_x86-trunk_staging-eng, aosp_x86_64-trunk_staging-eng, \ aosp_barbet-trunk_staging-userdebug, aosp_oriole-trunk_staging-userdebug Change-Id: I36663e3d3693d4a1b4d0d0306e2202aa53933d59
9 daysMerge "add TEST_MAPPING" into mainTreehugger Robot
9 daysadd TEST_MAPPINGJames Zern
Run MctsMediaV2TestCases, filtered by c2.android.vp[89], with updates to this tree. This is a postsubmit to allow SLO data to be gathered. Test: presubmit Change-Id: I3e81761b160f7b999883e3996bb661b0301222bd
11 daysUpdate CHANGELOGJerome Jiang
Bug: webm:1854 Change-Id: I3242d7fd58838aa8c4103ae07a67deb9dcc7dd37
11 daysUpdate CHANGELOG for fixes to ubsan errorsJerome Jiang
Bug: webm:1854 Change-Id: I81050a6a69721062078e818ca3ce23994749f711
12 daysFix some UBSan errors in vp8_new_framerate()Wan-Teh Chang
Fix some UBSan errors in the calculations of cpi->av_per_frame_bandwidth and cpi->min_frame_bandwidth in vp8_new_framerate() and in the calculation of cpi->per_frame_bandwidth in encode_frame_to_data_rate(). A port of the VP9 changes in https://chromium-review.googlesource.com/c/webm/libvpx/+/4944271 and https://chromium-review.googlesource.com/c/webm/libvpx/+/5565157 to VP8. Similar to the libaom CL https://aomedia-review.googlesource.com/c/aom/+/190462. Bug: aomedia:3509 Change-Id: I77b0e0b2f9fe667428daa9c4ceec0a35aafbfa81 (cherry picked from commit 25540b3c127f522aae382c79872d9ee03f7307f3)
2024-05-24Fix a UBSan error in vp9_rc_update_framerate()Wan-Teh Chang
Fix a UBSan error in the calculation of rc->min_frame_bandwidth in vp9_rc_update_framerate(). A follow-up to https://chromium-review.googlesource.com/c/webm/libvpx/+/4944271. Similar to the libaom CL https://aomedia-review.googlesource.com/c/aom/+/190462. Bug: aomedia:3509 Change-Id: I36168a6d00cd81e60ae19a7d74c21f2e6c2f0caf (cherry picked from commit 1f65facb63c8227156b5a276e506bb44a7c10608)
2024-05-22Update AUTHOR, version and CHANGELOGJerome Jiang
Bug: webm:1854 Change-Id: I0801e9b685d395c7556e2269601f4c01ab310661
2024-05-21Fix a bug in alloc_size for high bit depthsWan-Teh Chang
I introduced this bug in commit 2e32276: https://chromium-review.googlesource.com/c/webm/libvpx/+/5446333 I changed the line stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s; to three lines: s = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s; if (s > INT_MAX) goto fail; stride_in_bytes = (int)s; But I didn't realize that `s` is used later in the calculation of alloc_size. As a quick fix, undo the effect of s * 2 for high bit depths after `s` has been assigned to stride_in_bytes. Bug: chromium:332382766 Change-Id: I53fbf405555645ab1d7254d31aadabe4f426be8c (cherry picked from commit 74c70af01667733483dc69298b8921779f5f6ff3)
2024-05-21Apply stride_align to byte count, not pixel countWan-Teh Chang
A port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/188962. stride_align is documented to be the "alignment, in bytes, of each row in the image (stride)." Change-Id: I2184b50dc3607611f47719319fa5adb3adcef2fd (cherry picked from commit 7d37ffacc6f7c45554b48ca867be4223248f1ed6)
2024-05-21Avoid wasted calc of stride_in_bytes if !img_dataWan-Teh Chang
Change-Id: If1ddde5e894a06359f15486a2cee054a2f0cb1a2 (cherry picked from commit 8b2f8baee5acdc579b90a72e6ea787d4103b462e)
2024-05-21Avoid integer overflows in arithmetic operationsWan-Teh Chang
A port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/188823. Impose maximum values on the input parameters so that we can perform arithmetic operations without worrying about overflows. Also change the VpxImageTest.VpxImgAllocHugeWidth test to write to the first and last samples in the first row of the Y plane, so that the test will crash if there is unsigned integer overflow in the calculation of stride_in_bytes. Bug: chromium:332382766 Change-Id: I54cec6c9e26377abaa8a991042ba277ff70afdf3 (cherry picked from commit 06af417e795e6a9b9309406ba399fb109def89e6)
2024-05-21Fix integer overflows in calc of stride_in_bytesWan-Teh Chang
A port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/188761. Fix unsigned integer overflows in the calculation of stride_in_bytes in img_alloc_helper() when d_w is huge. Change the type of stride_in_bytes from unsigned int to int because it will be assigned to img->stride[VPX_PLANE_Y], which is of the int type. Test: . ../libvpx/tools/set_analyzer_env.sh integer ../libvpx/configure --enable-debug --disable-optimizations make -j ./test_libvpx --gtest_filter=VpxImageTest.VpxImgAllocHugeWidth Bug: chromium:332382766 Change-Id: I3b39d78f61c7255e10cbf72ba2f4975425a05a82 (cherry picked from commit 2e32276277c0b1739707c5e861c96cf78794f1a0)
2024-05-21Add test/vpx_image_test.ccWan-Teh Chang
Ported from test/aom_image_test.cc in libaom commit 04d6253. Change-Id: I56478d0a5603cfb5b65e644add0918387ff69a00 (cherry picked from commit 3dbab0e66479e1b5368d4b7a069051dba85843cf)
2024-05-21Make img_alloc_helper() fail on VPX_IMG_FMT_NONEWan-Teh Chang
If fmt is VPX_IMG_FMT_NONE, currently img_alloc_helper() allocates a single plane because VPX_IMG_FMT_NONE (0) is not a planar format (the VPX_IMG_FMT_PLANAR bit is not set in VPX_IMG_FMT_NONE). Although this seems correct, the problem is that most of the code in libvpx assumes planar formats and is likely to dereference a null pointer when it uses img->planes[1]. Also, VPX_IMG_FMT_NONE isn't really a valid image format. So it is safer to make img_alloc_helper() fail if fmt is VPX_IMG_FMT_NONE. Change-Id: I05b47f4b5eceb631a02384b2cce1c2f6fdca8673 (cherry picked from commit d3a946de8cf47f96b45f8903286b0f2d47f66114)
2024-05-14Merge "Snap for 11841552 from 339295c0130390e9292e81d93941cc75f20eb369 to ↵Android Build Coastguard Worker
sdk-release" into sdk-release
2024-05-14Snap for 11841552 from 339295c0130390e9292e81d93941cc75f20eb369 to sdk-releaseAndroid Build Coastguard Worker
Change-Id: I1856f4ce6e23746a04380ffb5c13aed13e007b66
2024-05-14Fix error handling in vp9_pack_bitstream()Deepa K G
In multi-threaded scenario, when the bitstream buffer allocated is insufficient, the main thread called 'longjmp' without waiting for the completion of workers. In this patch, 'longjmp' is called by the main thread after joining other worker threads. This resolves the assertion failure as reported in Bug: webm:1847 Bug: webm:1844 Change-Id: I399c76087b65e7b8d9a9fa4f12d784408243d648 (cherry picked from commit 611d9ba0a55df154ff5cb7a97d41a41103265f5e)
2024-05-14Perform bounds checks in vpx_write_bit_bufferWan-Teh Chang
Add the `size` and `error` members to the vpx_write_bit_buffer struct. Add the vpx_wb_init() and vpx_wb_has_error() functions. Instances of the vpx_write_bit_buffer struct are only allocated in the vp9_pack_bitstream() function. So vp9_pack_bitstream() is the only function outside vpx_dsp/bitwriter_buffer.* that needs updating. This CL completes the work of adding output buffer bounds checks to vp9/encoder/vp9_bitstream.c. Bug: webm:1844 Change-Id: I6b362be572852ee51d96023b35bfb334faada7e1 (cherry picked from commit d790001fd56edbc39482d596868ed83ee7355368)
2024-05-14Perform bounds checks in vpx_writerWan-Teh Chang
In the vpx_writer struct, change the buffer_end field to the size field. Change vpx_stop_encode() to return true on success, false on failure (output buffer full). In write_compressed_header(), remove the assertion assert(header_bc.pos <= 0xffff). The caller (vp9_pack_bitstream()) will check that condition. In vp9_pack_bitstream(), the variable "first_part_size" is renamed "compressed_hdr_size". Bug: webm:1844 Change-Id: I4ed6ab905a707ad44d875e53036d5a42523a65d0 (cherry picked from commit 73703c188b81f41bae59a72c9c86f8383587e994)
2024-05-14vp9_pack_bitstream: remove a dead storeJames Zern
Fixes a static analysis warning: Value stored to 'data_size' is never read Bug: webm:1844 Change-Id: Ia27181b1051bb2c3a6bc4a4c2549df8b0525e889 (cherry picked from commit 9f733778218d198181bbedcfd03653e3ef48667c)
2024-05-14Add the buffer_end field to the vpx_writer structWan-Teh Chang
The buffer_end field will allow bounds checking when vpx_writer writes to the output buffer. This CL sets up the plumbing to pass the output buffer size from vp9_pack_bitstream() to vpx_start_encode(), which initializes the vpx_writer struct. vpx_writer doesn't use the output buffer size in bounds checks yet, but the code in vp9_bitstream.c does. Bug: webm:1844 Change-Id: I995e469ab453c02d740f54b46e0b08c7f2eb1a2e (cherry picked from commit e3871874386985325676426451869aa401fefa28)
2024-05-14Pass output buffer size to vp9_pack_bitstream()Wan-Teh Chang
Set up the plumbing to pass the size of the output buffer `dest` to vp9_pack_bitstream(). The output buffer is the cx_data buffer in the encoder_encode() function in vp9/vp9_cx_iface.c, and its size is cx_data_sz. In this CL vp9_pack_bitstream() ignores the `dest_size` parameter. Bug: webm:1844 Change-Id: I53c80280143d409cf16f87c4d6deec3d9338aea3 (cherry picked from commit d48577579bd009e0a6c3145ea528a42d70560d95)
2024-05-13Merge "VP9: add vpx_codec_get_global_headers() support" into mainJames Zern
2024-05-10VP9: add vpx_codec_get_global_headers() supportJames Zern
This returns the contents of CodecPrivate described in: https://www.webmproject.org/docs/container/#vp9-codec-feature-metadata-codecprivate The value for 4:2:0 is 1 (colocated) to match the default given for the codec parameter string: https://www.webmproject.org/vp9/mp4/#codecs-parameter-string Bug: b:332052663 Test: presubmit Change-Id: Ie50dd8d76e2d7389ac01bf4dbec801f9c8ea0e21 (cherry picked from commit 63b9c2c0e2aeaa2964b7b64d803a198003dcb853) (cherry picked from commit e44918bd4e83fe4994eb1396a1c2da88862e24d7)
2024-05-08vp9 rc: Fix GetSegmentationData() crash in aq_mode=0Hirokazu Honda
cpi_->cyclic_refresh is nullptr if aq_mode is 0, in other words, the rate controller runs in non adaptive quantization mode. This CL fixes the crash in GetSegmentationData() in non aq mode. Bug: b/259487065 Test: video encoding on ChromeOS Change-Id: I503b30d15c697c8dd1da203b3c7361b91c428e87 (cherry picked from commit 1d007eafa346afe80b4e90b5906d97128d2f7292)
2024-05-08vp9: Fix to alloc for row_base_thresh_freq_facMarco Paniconi
Issue happens for real-time nonrd pickmode. Due to speed feature: sf->adaptive_rd_thresh_row_mt, enabled for speed >= 8, and for speed >= 7 svc only. Issue occurs where resolution (sb_rows) changes and row_base_thresh_freq_fact needs to be re-allocated. Fix is to add sb_rows to TileDataEnc and check for re-alloc of row_base_thresh_freq_fac. Bug: b:331108922 Change-Id: I1a1ca94c14f343200c180725e4cb8d91d3c55b83 (cherry picked from commit 3f8f19372b315f3d4d6342d77498293d5786de00)
2024-05-08Free row mt memory before freeing cpi->tile_dataWan-Teh Chang
In vp9_init_tile_data(), call vp9_row_mt_mem_dealloc(cpi) to free the row mt memory in cpi->tile_data before freeing cpi->tile_data. Bug: b:331086799, b:331108729 Change-Id: Idc79984ce7e0110e6858139b2ed286492a2e8622 (cherry picked from commit 34277e53addcf1b5490764d19ea2a0fcdd324c14)
2024-05-08encode_api_test.cc: assert encoder is initializedJames Zern
Before proceeding with Encode(). This avoids some static analysis warnings about uninitialized `cfg_` members. Change-Id: Ib67b278d6706ab1034219e8c1ad9ba0c5b574ba8 (cherry picked from commit 108f5128e2969451f77b1523ce30bebe545cdd58)
2024-05-07Handle EINTR from sem_wait()Wan-Teh Chang
sem_wait() may be interrupted by a signal and fail with EINTR: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_wait.html Retry the sem_wait() call if it fails with EINTR. This finishes the fix started in https://chromium-review.googlesource.com/c/webm/libvpx/+/5299569. As a speculative fix, that CL fixed only the sem_wait(&cpi->h_event_end_lpf) calls responsible for bug chromium:324459561. ClusterFuzz verified the fix, so this CL extends it to the other sem_wait() calls. Note that sem_wait() calls like the following do not need this fix, because the while (1) loop retries the sem_wait() call if it fails: while (1) { if (vpx_atomic_load_acquire(&cpi->b_multi_threaded) == 0) break; if (sem_wait(&cpi->h_event_start_lpf) == 0) { ... } } Bug: chromium:324459561 Change-Id: I0f0612616eee37fb3da68049e49b3e86927b5e24 (cherry picked from commit d4959f9825be05627754750a618d5aa726b01a73)
2024-05-03configure: Do more elaborate test of whether SVE can be compiledJames Zern
This is a port of the change in libaom: https://aomedia-review.googlesource.com/c/aom/+/189761 5ccdc66ab6 cpu.cmake: Do more elaborate test of whether SVE can be compiled For Windows targets, Clang will successfully compile simpler SVE functions, but if the function requires backing up and restoring SVE registers (as part of the AAPCS calling convention), Clang will fail to generate unwind data for this function, resulting in an error. This issue is tracked upstream in Clang in https://github.com/llvm/llvm-project/issues/80009. Check whether the compiler can compile such a function, and disable SVE if it is unable to handle that case. Change-Id: I8550248abd6a7876bd8ecf6ba66bc70518133566 (cherry picked from commit 35f0262c5e9dc9f69421b8d602e081311d3a18ea)
2024-05-02VP9: add vpx_codec_get_global_headers() supportJames Zern
This returns the contents of CodecPrivate described in: https://www.webmproject.org/docs/container/#vp9-codec-feature-metadata-codecprivate The value for 4:2:0 is 1 (colocated) to match the default given for the codec parameter string: https://www.webmproject.org/vp9/mp4/#codecs-parameter-string Bug: b:332052663 Change-Id: Ie50dd8d76e2d7389ac01bf4dbec801f9c8ea0e21 (cherry picked from commit 63b9c2c0e2aeaa2964b7b64d803a198003dcb853)
2024-03-26Merge "Snap for 11630439 from 3df18e52d4e68ecdabff9740b55637f2b3bf1e7f to ↵Android Build Coastguard Worker
sdk-release" into sdk-release
2024-03-26Snap for 11630439 from 3df18e52d4e68ecdabff9740b55637f2b3bf1e7f to sdk-releaseAndroid Build Coastguard Worker
Change-Id: Iaad839985b25fe064ff0e0ca439d706f923ab9f3
2024-03-26vp9: fix to integer overflow testMarco Paniconi
failure for the 16k test: issue introduced in: c29e637283 Bug: b/329088759, b/329674887, b/329179808 Change-Id: I88e8a36b7f13223997c3006c84aec9cfa48c0bcf (cherry picked from commit 19832b1702d5b0adf616a0e080abd5207c8445b5)
2024-03-26Fix to buffer alloc for vp9_bitstream_worker_dataMarco Paniconi
The code was using the bitstream_worker_data when it wasn't allocated for big enough size. This is because the existing condition was to only re-alloc the bitstream_worker_data when current dest_size was larger than the current frame_size. But under resolution change where frame_size is increased, beyond the current dest_size, we need to allow re-alloc to the new size. The existing condition to re-alloc when dest_size is larger than frame_size (which is not required) is kept for now. Also increase the dest_size to account for image format. Added tests, for both ROW_MT=0 and 1, that reproduce the failures in the bugs below. Note: this issue only affects the REALTIME encoding path. Bug: b/329088759, b/329674887, b/329179808 Change-Id: Icd65dbc5317120304d803f648d4bd9405710db6f (cherry picked from commit c29e63728316486082dd6083c2062434b441b77d)
2024-03-26Add high bit depths, 4:2:2, 4:4:4 to VP9EncoderWan-Teh Chang
A port of the changes to vp9_encoder_fuzz_test.cc in https://chromium-review.googlesource.com/c/chromium/src/+/5292940. Change-Id: Ie143ffd9cffbd6a8639812c72e85c9a017aa554e (cherry picked from commit 8c36d36bccb1af490bf201dd754294db82cebbc3)
2024-03-26Fix several clang-tidy complaintsJerome Jiang
Change-Id: I78721d6b7ed692ad9363b5cac4e3324a3136d5b6 (cherry picked from commit 4c2435c33e12a72640e96262f982a9f5f5c513cd)
2024-03-23Merge "Remove useless `neon:` clause." into mainTreehugger Robot
2024-03-23Remove useless `neon:` clause.Harish Mahendrakar
There hasn't been a non-neon platform build in years. Bug: 330929681 Test: Builds Change-Id: I85297ba6f0472cd233196c02a8bd085b2cc3c1c9
2024-03-07Merge "Snap for 11541002 from 599b082f099b5d6c1cdcb96f3ec8378f4ea21bf4 to ↵platform-tools-35.0.1Android Build Coastguard Worker
sdk-release" into sdk-release
2024-03-07Snap for 11541002 from 599b082f099b5d6c1cdcb96f3ec8378f4ea21bf4 to sdk-releaseAndroid Build Coastguard Worker
Change-Id: I1eecf2c2784d6e28c270bd24c6de76c4881b74a5
2024-02-28Only enable AArch64 extensions if the compiler supports themGeorge Steed
We already have some logic in the configure.sh file to selectively disable code dependent on particular architecture extensions, however we do not yet have anything to check that the compiler being supplied recognises and can compile code using these extensions. This commit adds compiler "-march=..." flag tests to the existing extension-disable loop so that we now correctly disable extensions that are not supported by the compiler. For AArch64 this loop also needs to move below the existing compiler/OS handling to ensure that prefixes like $CROSS are handled correctly before running compiler tests. Bug: webm:1841 Change-Id: I936b911c4b0ebf03abc34b7532b2bb4568129f57 (cherry picked from commit fa50b26848ebd89915ec2a5a138a23f1fe69d5eb)
2024-02-28Require Arm Neon-SVE bridge header for enabling SVEGerda Zsejke More
Disable SVE feature if arm_neon_sve_bridge header is not supported by the compiler. Change-Id: I3f78be2dd95b37b8d51b9f1fceca1f9701535eca (cherry picked from commit 6ea3b51ec2853dbdf5508618ab7cd7d1d719f453)
2024-02-27Handle EINTR from sem_wait(&cpi->h_event_end_lpf)Wan-Teh Chang
sem_wait() may be interrupted by a signal and fail with EINTR: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_wait.html Retry the sem_wait(&cpi->h_event_end_lpf) call if it fails with EINTR. Bug: chromium:324459561 Change-Id: Icc957e8b9f21f25ec3c95e22cab502af417443f2 (cherry picked from commit d63efe0679b0a88136eebddf047c4b5fe57bfa90)
2024-02-27vp8: Fix to race issue for multi-thread with pnsr_calcMarco Paniconi
Added unitest which triggers the data race in the bug below, when only C code is forced. The data race is between the loopfilter and variance computation from generate_psnr_packet calculation. Proposed fix is to move the wait for loopfilter thread to finish up before entering generate_psnr_packet(). Bug: b/266833179. Change-Id: Id2871c53274be0f404e65601c9a5c98aaead0c72 (cherry picked from commit 756b29a776002b313cd8474dc18a3e76686bc849)
2024-02-02vp9_scale_and_extend_frame_ssse3: fix uv width/heightJames Zern
Use uv_crop_(width|height). This fixes an issue with 1 to 2 scaling from 1x1 where the unrounded value would go to zero, resulting in a heap overflow. This path is only executed when the library is built without --enable-vp9-highbitdepth. Bug: b:319964497 Change-Id: I9cb6632f864ec54c045608af86aede20657d6253 (cherry picked from commit 7ad5f4f695e5a083feaeb7ff3f4328829523c2e6)