Skip to content

Commit

Permalink
Upgrade libaom
Browse files Browse the repository at this point in the history
  • Loading branch information
novomesk committed Jul 2, 2024
1 parent be4aa0b commit 37d4677
Show file tree
Hide file tree
Showing 31 changed files with 1,031 additions and 183 deletions.
35 changes: 32 additions & 3 deletions ext/libavif/ext/aom/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
2024-06-05 v3.9.1
This release includes several bug fixes. This release is ABI
compatible with the last release. See
https://aomedia.googlesource.com/aom/+log/v3.9.0..v3.9.1 for all the
commits in this release.

- Bug Fixes
* aomedia:2754, aomedia:3567: Ensure thread stack size is at least
256 KB
* b:330639949, oss-fuzz:68195: Increase scaling in linsolve_wiener
* Fix high target data rate overflow.
* aomedia:3509: Fix two UBSan errors in av1_rc_update_framerate()
* aomedia:3382, chromium:339877165: update codec config after
svc/scale controls (CVE-2024-5493)
* aomedia:3561: libaom-3.8.2 armv7 Android build failed
* aomedia:3571: {,highbd_}intrapred_neon.c: Avoid over-reads in z1
and z3 preds
* aomedia:3578: libaom-3.9.0 undefined reference to
`aom_sub_pixel_variance16xh_ssse3'
* aomedia:3579: Use round for RC calculations in cyclic_refresh
* aomedia:3580: Allow g_timebase.num to be greater than
g_timebase.den
* oss-fuzz:68774: libaom:av1_dec_fuzzer: Segv on unknown address in
od_ec_dec_init
* Arm SVE build fixes.
* av1_block_error_lp_neon: fix block_size param type
* av1_block_error_lp_sve: fix block_size param type

2024-04-09 v3.9.0
This release includes new codec interfaces, compression efficiency and
perceptual improvements, speedup for RTC for both video and screen content,
Expand All @@ -24,10 +52,11 @@
* Visual quality improved for scene changes for SVC with quality layers.
* Removed visual artifacts for speed 11

- RTC speedups:
* Speed 11: aggressive speedup setting added for video mode,
- Speedups:
* RTC Speed 11: aggressive speedup setting added for video mode,
resolutions <= VGA: ~30% faster than speed 10.
* Arm specific SIMD improvements
* 5-9% speed up for high bit-depth encoding with good mode on Arm, half of
which comes from SVE/SVE2 optimizations.

- Other improvements
* Further improvements to global motion estimation.
Expand Down
2 changes: 1 addition & 1 deletion ext/libavif/ext/aom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ endif()
#
# We set SO_FILE_VERSION = [c-a].a.r
set(LT_CURRENT 12)
set(LT_REVISION 0)
set(LT_REVISION 1)
set(LT_AGE 9)
math(EXPR SO_VERSION "${LT_CURRENT} - ${LT_AGE}")
set(SO_FILE_VERSION "${SO_VERSION}.${LT_AGE}.${LT_REVISION}")
Expand Down
1 change: 1 addition & 0 deletions ext/libavif/ext/aom/aom/aom_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ typedef struct aom_codec_enc_cfg {
/*!\brief Target data rate
*
* Target bitrate to use for this stream, in kilobits per second.
* Max allowed value is 2000000
*/
unsigned int rc_target_bitrate;

Expand Down
36 changes: 24 additions & 12 deletions ext/libavif/ext/aom/aom/aom_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ typedef enum aom_transfer_characteristics {
AOM_CICP_TC_SMPTE_428 = 17, /**< SMPTE ST 428 */
AOM_CICP_TC_HLG = 18, /**< BT.2100 HLG, ARIB STD-B67 */
AOM_CICP_TC_RESERVED_19 = 19 /**< For future use (values 19-255) */
} aom_transfer_characteristics_t; /**< alias for enum aom_transfer_function */
} aom_transfer_characteristics_t; /**< alias for enum
aom_transfer_characteristics */

/*!\brief List of supported matrix coefficients */
typedef enum aom_matrix_coefficients {
Expand All @@ -125,7 +126,7 @@ typedef enum aom_matrix_coefficients {
AOM_CICP_MC_CHROMAT_CL = 13, /**< Chromaticity-derived constant luminance */
AOM_CICP_MC_ICTCP = 14, /**< BT.2100 ICtCp */
AOM_CICP_MC_RESERVED_15 = 15 /**< For future use (values 15-255) */
} aom_matrix_coefficients_t;
} aom_matrix_coefficients_t; /**< alias for enum aom_matrix_coefficients */

/*!\brief List of supported color range */
typedef enum aom_color_range {
Expand All @@ -144,7 +145,8 @@ typedef enum aom_chroma_sample_position {
/**< sample, between two vertical samples */
AOM_CSP_COLOCATED = 2, /**< Co-located with luma(0, 0) sample */
AOM_CSP_RESERVED = 3 /**< Reserved value */
} aom_chroma_sample_position_t; /**< alias for enum aom_transfer_function */
} aom_chroma_sample_position_t; /**< alias for enum aom_chroma_sample_position
*/

/*!\brief List of insert flags for Metadata
*
Expand Down Expand Up @@ -244,10 +246,13 @@ typedef struct aom_image {
* is NULL, the storage for the descriptor will be
* allocated on the heap.
* \param[in] fmt Format for the image
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
* \param[in] d_w Width of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] d_h Height of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] align Alignment, in bytes, of the image buffer and
* each row in the image (stride).
* each row in the image (stride). Must not exceed
* 65536.
*
* \return Returns a pointer to the initialized image descriptor. If the img
* parameter is non-null, the value of the img parameter will be
Expand All @@ -267,10 +272,12 @@ aom_image_t *aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt,
* is NULL, the storage for the descriptor will be
* allocated on the heap.
* \param[in] fmt Format for the image
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
* \param[in] d_w Width of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] d_h Height of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] align Alignment, in bytes, of each row in the image
* (stride).
* (stride). Must not exceed 65536.
* \param[in] img_data Storage to use for the image
*
* \return Returns a pointer to the initialized image descriptor. If the img
Expand All @@ -291,12 +298,17 @@ aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
* is NULL, the storage for the descriptor will be
* allocated on the heap.
* \param[in] fmt Format for the image
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
* \param[in] d_w Width of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] d_h Height of the image. Must not exceed 0x08000000
* (2^27).
* \param[in] align Alignment, in bytes, of the image buffer and
* each row in the image (stride).
* each row in the image (stride). Must not exceed
* 65536.
* \param[in] size_align Alignment, in pixels, of the image width and height.
* Must not exceed 65536.
* \param[in] border A border that is padded on four sides of the image.
* Must not exceed 65536.
*
* \return Returns a pointer to the initialized image descriptor. If the img
* parameter is non-null, the value of the img parameter will be
Expand Down
43 changes: 28 additions & 15 deletions ext/libavif/ext/aom/aom/src/aom_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/

#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -36,13 +37,20 @@ static aom_image_t *img_alloc_helper(
/* NOTE: In this function, bit_depth is either 8 or 16 (if
* AOM_IMG_FMT_HIGHBITDEPTH is set), never 10 or 12.
*/
unsigned int h, w, s, xcs, ycs, bps, bit_depth;
unsigned int stride_in_bytes;
unsigned int xcs, ycs, bps, bit_depth;

if (img != NULL) memset(img, 0, sizeof(aom_image_t));

if (fmt == AOM_IMG_FMT_NONE) goto fail;

/* Impose maximum values on input parameters so that this function can
* perform arithmetic operations without worrying about overflows.
*/
if (d_w > 0x08000000 || d_h > 0x08000000 || buf_align > 65536 ||
stride_align > 65536 || size_align > 65536 || border > 65536) {
goto fail;
}

/* Treat align==0 like align==1 */
if (!buf_align) buf_align = 1;

Expand Down Expand Up @@ -105,12 +113,17 @@ static aom_image_t *img_alloc_helper(
}

/* Calculate storage sizes given the chroma subsampling */
w = align_image_dimension(d_w, xcs, size_align);
h = align_image_dimension(d_h, ycs, size_align);

s = (fmt & AOM_IMG_FMT_PLANAR) ? w : bps * w / bit_depth;
s = (s + 2 * border + stride_align - 1) & ~(stride_align - 1);
stride_in_bytes = s * bit_depth / 8;
const unsigned int w = align_image_dimension(d_w, xcs, size_align);
assert(d_w <= w);
const unsigned int h = align_image_dimension(d_h, ycs, size_align);
assert(d_h <= h);

uint64_t s = (uint64_t)w + 2 * border;
s = (fmt & AOM_IMG_FMT_PLANAR) ? s : s * bps / bit_depth;
s = s * bit_depth / 8;
s = (s + stride_align - 1) & ~((uint64_t)stride_align - 1);
if (s > INT_MAX) goto fail;
const int stride_in_bytes = (int)s;

/* Allocate the new image */
if (!img) {
Expand Down Expand Up @@ -232,7 +245,7 @@ int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,

img->planes[AOM_PLANE_Y] =
data + x * bytes_per_sample + y * img->stride[AOM_PLANE_Y];
data += (img->h + 2 * border) * img->stride[AOM_PLANE_Y];
data += ((size_t)img->h + 2 * border) * img->stride[AOM_PLANE_Y];

unsigned int uv_border_h = border >> img->y_chroma_shift;
unsigned int uv_x = x >> img->x_chroma_shift;
Expand All @@ -244,14 +257,14 @@ int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
} else if (!(img->fmt & AOM_IMG_FMT_UV_FLIP)) {
img->planes[AOM_PLANE_U] =
data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_U];
data += ((img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
data += ((size_t)(img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
img->stride[AOM_PLANE_U];
img->planes[AOM_PLANE_V] =
data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_V];
} else {
img->planes[AOM_PLANE_V] =
data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_V];
data += ((img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
data += ((size_t)(img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
img->stride[AOM_PLANE_V];
img->planes[AOM_PLANE_U] =
data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_U];
Expand Down Expand Up @@ -291,15 +304,15 @@ void aom_img_free(aom_image_t *img) {
}

int aom_img_plane_width(const aom_image_t *img, int plane) {
if (plane > 0 && img->x_chroma_shift > 0)
return (img->d_w + 1) >> img->x_chroma_shift;
if (plane > 0)
return (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift;
else
return img->d_w;
}

int aom_img_plane_height(const aom_image_t *img, int plane) {
if (plane > 0 && img->y_chroma_shift > 0)
return (img->d_h + 1) >> img->y_chroma_shift;
if (plane > 0)
return (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift;
else
return img->d_h;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/libavif/ext/aom/aom_dsp/arm/highbd_convolve8_sve.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void aom_highbd_convolve8_vert_sve(const uint8_t *src8, ptrdiff_t src_stride,
const int16_t *filter_y, int y_step_q4,
int width, int height, int bd) {
assert(y_step_q4 == 16);
assert(w >= 4 && h >= 4);
assert(width >= 4 && height >= 4);
(void)filter_x;
(void)y_step_q4;
(void)x_step_q4;
Expand Down
Loading

0 comments on commit 37d4677

Please sign in to comment.