aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
5 daysvp9-rtc: Fix integer overflow in key frame target sizeupstream-mainMarco Paniconi
The integer overflow happens in vp9_calc_iframe_target_size_one_pass_cbr(), when calculating the target size for L1T3 encoding. The input target bitrate(kbps) is very large, so it gets set to INT_MAX (before being multiplied by 1000 to convert to bps), and avg_frame_bandwidth is then set to (INT_MAX / lc->framerate), which when multipled by (16 + kf_boost) can exceed INT_MAX. Fix is to cast the operands to int64_t and final result to int. Bug: chromium:340918567 Change-Id: Ic00094b22c1f12ca988c0cb1fcaed473e1f8ed2b
8 daysFix 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
8 daysvpx_decoder.h: Change "size member" to "sz member"Wan-Teh Chang
That member of vpx_codec_stream_info_t is named "sz", not "size". Change-Id: I6cc878709d9dae37b9911cf746ba248a06ec1b1a
8 daysvpx_dec_fuzzer.cc: Initialize stream_info.szWan-Teh Chang
stream_info.sz should be initialized to sizeof(stream_info). Bug: oss-fuzz:68912 Change-Id: I0cc0fcdfc93b7188a834ee1896f0bb4cf8c32fa9
8 daysAdd vp9_ratectrl.h header to vp9_firstpass.cAngie Chiang
KF_STD/GF_ARF_STD are used in vp9_firstpass.c and defined in vp9_ratectrl.h Change-Id: I5a6e42faa23e5f50630926e336daef37055fd195
10 daysAssert a vpx_img_set_rect call always succeedWan-Teh Chang
The vpx_img_set_rect() call at the end of img_alloc_helper() always succeeds, so assert its return value is equal to 0. A port of the changes to aom/src/aom_image.c in the libaom CLs https://aomedia-review.googlesource.com/c/aom/+/90307 and https://aomedia-review.googlesource.com/c/aom/+/190011. Bug: webm:1850 Change-Id: I559820db245a596b4aed2042bfa7ebe7dd2d69b7
11 daysvpx_dec_fuzzer: add vpx_codec_peek_stream_info coverageJames Zern
Change-Id: I511539292cb8c2098c81f5fe3d711b9739482ffa
12 daysvp9 rc: also run tpl for GOPs without ARFJerome Jiang
Tested with ffmpeg integration end to end test. Bug: b/338393251 Change-Id: I4048036d35f8ab64c07305b838d091f765f64a8d
13 daysvpx_ext_ratectrl.h,cosmetics: Correspondent -> CorrespondsJames Zern
+ add some doxygen autolinks Change-Id: Ifceb7d9e89d31037d0b690b1d661cebcd6fa67b8
2024-05-03encode_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
2024-05-03Fix a rare memory overflow bugYunqing Wang
In very rare cases (e.g. encoding with very high bit rate), the allocated token memory isn't enough, which causes a buffer overflow and then an encoder failure. This is fixed by using the aligned number of blocks while allocating this buffer. BUG=b/328803779 Change-Id: I5437cce13398206bf9982d57f35d6f9da17b187f
2024-05-03vp9_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
2024-05-02configure: 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
2024-05-02vp9_ethread_test: move 'best' mode to a Large testJames Zern
This mode is used infrequently and is quite slow. This shifts the tests to nightly to speed up the presubmit. Change-Id: I3020887e0ca0150d7cbea9cc726649c11f94d56c
2024-05-02Add several utility functions to set gf_groupAngie Chiang
Use the utility functions and set gf_group_size in ext_rc_define_gf_group_structure() Avoid using gop_decision->update_type to keep the logic simple for now. Also simplify the interface. Change-Id: I78fd5892e6f9731d50d6e5da97598b46c70a1dde
2024-05-02Remove vpx_ports/msvc.hWan-Teh Chang
The vpx_ports/msvc.h header provides snprintf() and round() for MSVC older than Visual Studio 2015 and Visual Studio 2013, respectively. Since configure now requires vs14 (Visual Studio 2015) or later, it is safe to remove vpx_ports/msvc.h. Change-Id: I2fe4c41eaa126f4cf17639c11895f1e464294c76
2024-05-02vpx_ext_ratectrl.h: make rate_ctrl_log_path constJames Zern
Change-Id: I499d77b25ca3dcdbd3c72fb319f9023e9a2823b0
2024-05-02Better format comments for vpx_ext_ratectrl.hJerome Jiang
For vpx_rc_type_t: comment for each enum is moved to where it is defined. Change-Id: Ic1e2097ed381e7d71746792e0d517106db882685
2024-05-02Fix comments in vpx_ext_ratectrl.hJerome Jiang
Added file level descriptor Added comments for vpx_rc_ref_frame_t Change-Id: Ifb000650821eab719b6e0fd003a00027ea132b9f
2024-05-02Include <stdio.h> or <cstdio> for *printf()Wan-Teh Chang
Change-Id: Ifc0537fe5ae1223418fb68da5583cc72ae2c32a8
2024-05-02encode_api_test.cc: apply iwyuJames Zern
add missing <cstdio> and <cstdlib> and delete some unused headers. Change-Id: I6c66368f557e6df896bffb2aa90228811f14f027
2024-05-01vpx_ext_ratectrl.h: fix doxygen commentsJames Zern
fixes a few warnings about undocumented members update_type, update_ref_index and ref_frame_list. Change-Id: I668c61f6a511ba9e6c0907f6dafb0be614678e60
2024-05-01Print gop_index in ENCODE_FRAME_RESULTAngie Chiang
Change-Id: Icb522110dd2a7f87212ec0e7fc2638245008365f
2024-04-26vp9_rdopt.c: make init_frame_mv staticJames Zern
fixes a -Wmissing-prototypes warning Change-Id: Ie380f9e4211ffab461f15dfe84184b8769d4f7bd
2024-04-25VP9: 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
2024-04-19Add VPX_RC_NONEAngie Chiang
Change-Id: I8ca4caa7ffc4e9f8590ad8d02de0348b88c45254
2024-04-19vp9_encoder.c: fix printf format stringJames Zern
Replace %ld with %zu for `size_t`. Added in: fd28f6f3c Add rate_ctrl_log_path Fixes: vp9\encoder\vp9_encoder.c(5748,15): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 2 has type 'size_t' Change-Id: I36fa9c7a9e14d4a2d9ef51a7f5c55de71bb34518
2024-04-18vpx_image_test.cc: add missing stdint includeJames Zern
fixes clang-tidy warning: no header providing "uint16_t" is directly included Change-Id: Ic71045ce6f88659ecd22243d473a3b6dc8c827dd
2024-04-17Add rate_ctrl_log_pathAngie Chiang
Change-Id: I4dc25c9ce4103cf3de44cff4d63e8ff8c82f35c0
2024-04-16Initialize frame_mv in rd pick interJerome Jiang
Bug: b/334626386 Change-Id: Ie480a08f09c1b212b4163a5f6eb191c35510236f
2024-04-13Add 10 and 12b ranges to vpx_color_range_t commentWan-Teh Chang
Add note about undefined behavior in vpx_codec_encode() description. A port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/158001 by Yannis Guyon <yguyon@google.com>. Bug: webm:1850 Change-Id: Ia90f0bfd8265e35e9f33c17400c1c065d7915b77
2024-04-13Clarify comment about buf_align in vpx_img_wrap.Wan-Teh Chang
If img_data is not NULL, img_alloc_helper ignores buf_align, so vpx_img_wrap can set buf_align to any placeholder value. A port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/90362. Bug: webm:1850 Change-Id: I42bc45aecf822a9314caf23058fe123d0574dc20
2024-04-13Introduce local vars uv_x,uv_y in vpx_img_set_rectWan-Teh Chang
Port the changes to aom/src/aom_image.c in the libaom CL https://aomedia-review.googlesource.com/c/aom/+/56643. The changes related to `border` are not ported. Bug: webm:1850 Change-Id: Ie81fffe0c84e912da880ffca245ae27cd71cf348
2024-04-12Fix 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
2024-04-11Apply 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
2024-04-11Avoid wasted calc of stride_in_bytes if !img_dataWan-Teh Chang
Change-Id: If1ddde5e894a06359f15486a2cee054a2f0cb1a2
2024-04-11Avoid 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
2024-04-10Fix 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
2024-04-10Add test/vpx_image_test.ccWan-Teh Chang
Ported from test/aom_image_test.cc in libaom commit 04d6253. Change-Id: I56478d0a5603cfb5b65e644add0918387ff69a00
2024-04-04Define the MAX_NUM_THREADS macro in vp9_ethread.hWan-Teh Chang
The MAX_NUM_THREADS macro is unrelated to the VPxWorkerInterface, so it doesn't need to be defined in vpx_util/vpx_thread.h. The VP8 code doesn't seem to depend on MAX_NUM_THREADS, so VP8 can use 64 directly in the range check of its g_threads option. Move the definition of the MAX_NUM_THREADS macro to vp9/encoder/vp9_ethread.h and use it in VP9 code only. Change-Id: Ibf788ca2496c743a2ac0498fefaab8a3c181228d
2024-04-04Add missing header for EBUSY on mingwChun-Min Chang
The `error: use of undeclared identifier 'EBUSY'` in vpx_util/vpx_pthread.h was found in Mozilla's bug 1886318 [1]. This patch addresses the issue by adding the `<errno.h>` header to introduce the `EBUSY` identifier, resolving the problem. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1886318#c1 Change-Id: Ic417dafebf5ab160060dd29f692fa9c40d8db05a
2024-04-04Fix GCC -Wmissing-braces warningsWan-Teh Chang
warning: missing braces around initializer [-Wmissing-braces] Bug: webm:1846 Change-Id: I007a68d09f48d4199ecd948136e69f9cf5f219f5
2024-04-03Add missing configuration includesCasey Smalley
The Google cpp style guide dictates that you should "include what you use" with respect to symbols. This CL adds vpx_config.h imports to unit tests that rely on config flags but were otherwise indirectly included. Change-Id: Ia70a512cebe6c104d2d64afbed3cde8a405c68df
2024-04-03Unit test config changes for ChromiumCasey Smalley
This CL will help run libvpx tests under Chromium against its partition allocator. The allocator does not support single allocations above 3.998GiB. Because of this tests related to large video sizes that Chromium is configured for are expected to fail. Chromium also only supports the CONFIG_REALTIME_ONLY option, some changes are scoped behind this flag. Change-Id: I80e8743c0619ce502688109ce0be01cb252d5f92
2024-04-03Compare ctx->pending_cx_data with NULLWan-Teh Chang
ctx->pending_cx_data is a pointer. It looks nicer to compare ctx->pending_cx_data with NULL than with 0. Change-Id: I18815907b3d75551abfc603cb3c5c0297dceed23
2024-04-02vp9 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
2024-04-02Set priv->cx_data_sz to 0 if cx_data alloc failsWan-Teh Chang
Change-Id: I6553cd7b09270b4d60ccd7199d499e03c22b3936
2024-04-02encoder_encode: Assert pending_cx_data_sz is validWan-Teh Chang
In encoder_encode(), assert ctx->pending_cx_data_sz is not too big before the memmove() call. Change-Id: Icd1e95f6d751b0bf67386d0d99218b256bc91ebd
2024-04-02Dont use VPX_CODEC_CORRUPT_FRAME in set_frame_sizeWan-Teh Chang
VPX_CODEC_CORRUPT_FRAME is a decoder error. It is strange for vpx_codec_encode() to fail with this error. In set_frame_size(), change VPX_CODEC_CORRUPT_FRAME to VPX_CODEC_ERROR. The use of VPX_CODEC_CORRUPT_FRAME was originally added in commit 1ed56a46b3. Change-Id: Iee92ed4cfca5061289b278ece2ba475cf98fec06
2024-04-02Add SVE2 implementation of vpx_highbd_convolve8_avgGerda Zsejke More
Add SVE2 implementation of vpx_highbd_convolve8_avg function and the corresponding tests as well. Change-Id: I2ff707da55d11b1d5376eb0a7ec85c343a2709c2