- VP8: disallow thread count changes
- Fix bug with smaller width bigger size
This commit is contained in:
parent
916a16e8db
commit
d83cff9408
125
SOURCES/0001-Fix-bug-with-smaller-width-bigger-size.patch
Normal file
125
SOURCES/0001-Fix-bug-with-smaller-width-bigger-size.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
From 263682c9a29395055f3b3afe2d97be1828a6223f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jerome Jiang <jianj@google.com>
|
||||||
|
Date: Thu, 30 Jun 2022 13:48:56 -0400
|
||||||
|
Subject: [PATCH] Fix bug with smaller width bigger size
|
||||||
|
|
||||||
|
Fixed previous patch that clusterfuzz failed on.
|
||||||
|
|
||||||
|
Bug: webm:1642
|
||||||
|
Change-Id: If0e08e72abd2e042efe4dcfac21e4cc51afdfdb9
|
||||||
|
---
|
||||||
|
test/resize_test.cc | 9 +++------
|
||||||
|
vp9/common/vp9_alloccommon.c | 13 ++++++-------
|
||||||
|
vp9/encoder/vp9_encoder.c | 27 +++++++++++++++++++++++++--
|
||||||
|
3 files changed, 34 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/resize_test.cc b/test/resize_test.cc
|
||||||
|
index fd1c2a92de6..20ad2229b46 100644
|
||||||
|
--- a/test/resize_test.cc
|
||||||
|
+++ b/test/resize_test.cc
|
||||||
|
@@ -101,11 +101,8 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||||
|
*h = initial_h;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
- if (frame < 100) {
|
||||||
|
- *w = initial_w * 7 / 10;
|
||||||
|
- *h = initial_h * 16 / 10;
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
+ *w = initial_w * 7 / 10;
|
||||||
|
+ *h = initial_h * 16 / 10;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (frame < 10) {
|
||||||
|
@@ -578,7 +575,7 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) {
|
||||||
|
+TEST_P(ResizeRealtimeTest, TestExternalResizeSmallerWidthBiggerSize) {
|
||||||
|
ResizingVideoSource video;
|
||||||
|
video.flag_codec_ = true;
|
||||||
|
video.smaller_width_larger_size_ = true;
|
||||||
|
diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c
|
||||||
|
index e53883f621d..9e73e40ea09 100644
|
||||||
|
--- a/vp9/common/vp9_alloccommon.c
|
||||||
|
+++ b/vp9/common/vp9_alloccommon.c
|
||||||
|
@@ -131,13 +131,6 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
|
||||||
|
cm->free_mi(cm);
|
||||||
|
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
||||||
|
- // Create the segmentation map structure and set to 0.
|
||||||
|
- free_seg_map(cm);
|
||||||
|
- if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
if (cm->above_context_alloc_cols < cm->mi_cols) {
|
||||||
|
vpx_free(cm->above_context);
|
||||||
|
cm->above_context = (ENTROPY_CONTEXT *)vpx_calloc(
|
||||||
|
@@ -152,6 +145,12 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
|
||||||
|
cm->above_context_alloc_cols = cm->mi_cols;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
||||||
|
+ // Create the segmentation map structure and set to 0.
|
||||||
|
+ free_seg_map(cm);
|
||||||
|
+ if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (vp9_alloc_loop_filter(cm)) goto fail;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
|
||||||
|
index 69a4e3c314f..e3ba294c32f 100644
|
||||||
|
--- a/vp9/encoder/vp9_encoder.c
|
||||||
|
+++ b/vp9/encoder/vp9_encoder.c
|
||||||
|
@@ -1968,6 +1968,17 @@ static void alloc_copy_partition_data(VP9_COMP *cpi) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void free_copy_partition_data(VP9_COMP *cpi) {
|
||||||
|
+ vpx_free(cpi->prev_partition);
|
||||||
|
+ cpi->prev_partition = NULL;
|
||||||
|
+ vpx_free(cpi->prev_segment_id);
|
||||||
|
+ cpi->prev_segment_id = NULL;
|
||||||
|
+ vpx_free(cpi->prev_variance_low);
|
||||||
|
+ cpi->prev_variance_low = NULL;
|
||||||
|
+ vpx_free(cpi->copied_frame_cnt);
|
||||||
|
+ cpi->copied_frame_cnt = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
|
@@ -2047,6 +2058,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
|
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
|
||||||
|
if (cm->mi_alloc_size < new_mi_size) {
|
||||||
|
vp9_free_context_buffers(cm);
|
||||||
|
+ vp9_free_pc_tree(&cpi->td);
|
||||||
|
+ vpx_free(cpi->mbmi_ext_base);
|
||||||
|
alloc_compressor_data(cpi);
|
||||||
|
realloc_segmentation_maps(cpi);
|
||||||
|
cpi->initial_width = cpi->initial_height = 0;
|
||||||
|
@@ -2062,8 +2075,18 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
|
update_frame_size(cpi);
|
||||||
|
|
||||||
|
if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
|
||||||
|
- memset(cpi->consec_zero_mv, 0,
|
||||||
|
- cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv));
|
||||||
|
+ vpx_free(cpi->consec_zero_mv);
|
||||||
|
+ CHECK_MEM_ERROR(
|
||||||
|
+ cm, cpi->consec_zero_mv,
|
||||||
|
+ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(*cpi->consec_zero_mv)));
|
||||||
|
+
|
||||||
|
+ vpx_free(cpi->skin_map);
|
||||||
|
+ CHECK_MEM_ERROR(
|
||||||
|
+ cm, cpi->skin_map,
|
||||||
|
+ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(cpi->skin_map[0])));
|
||||||
|
+
|
||||||
|
+ free_copy_partition_data(cpi);
|
||||||
|
+ alloc_copy_partition_data(cpi);
|
||||||
|
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
|
||||||
|
vp9_cyclic_refresh_reset_resize(cpi);
|
||||||
|
rc->rc_1_frame = 0;
|
30
SOURCES/0002-VP8-disallow-thread-count-changes.patch
Normal file
30
SOURCES/0002-VP8-disallow-thread-count-changes.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 3fbd1dca6a4d2dad332a2110d646e4ffef36d590 Mon Sep 17 00:00:00 2001
|
||||||
|
From: James Zern <jzern@google.com>
|
||||||
|
Date: Mon, 25 Sep 2023 18:55:59 -0700
|
||||||
|
Subject: [PATCH] VP8: disallow thread count changes
|
||||||
|
|
||||||
|
Currently allocations are done at encoder creation time. Going from
|
||||||
|
threaded to non-threaded would cause a crash.
|
||||||
|
|
||||||
|
Bug: chromium:1486441
|
||||||
|
Change-Id: Ie301c2a70847dff2f0daae408fbef1e4d42e73d4
|
||||||
|
---
|
||||||
|
vp8/encoder/onyx_if.c | 5 +++++
|
||||||
|
1 files changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
|
||||||
|
index c65afc643bf..c5e9970c3cc 100644
|
||||||
|
--- a/vp8/encoder/onyx_if.c
|
||||||
|
+++ b/vp8/encoder/onyx_if.c
|
||||||
|
@@ -1445,6 +1445,11 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) {
|
||||||
|
last_h = cpi->oxcf.Height;
|
||||||
|
prev_number_of_layers = cpi->oxcf.number_of_layers;
|
||||||
|
|
||||||
|
+ if (cpi->initial_width) {
|
||||||
|
+ // TODO(https://crbug.com/1486441): Allow changing thread counts; the
|
||||||
|
+ // allocation is done once in vp8_create_compressor().
|
||||||
|
+ oxcf->multi_threaded = cpi->oxcf.multi_threaded;
|
||||||
|
+ }
|
||||||
|
cpi->oxcf = *oxcf;
|
||||||
|
|
||||||
|
switch (cpi->oxcf.Mode) {
|
@ -6,7 +6,7 @@
|
|||||||
Name: libvpx
|
Name: libvpx
|
||||||
Summary: VP8/VP9 Video Codec SDK
|
Summary: VP8/VP9 Video Codec SDK
|
||||||
Version: 1.9.0
|
Version: 1.9.0
|
||||||
Release: 5%{?dist}
|
Release: 7%{?dist}.alma.1
|
||||||
License: BSD
|
License: BSD
|
||||||
#Source0: http://downloads.webmproject.org/releases/webm/%{name}-%{version}.tar.bz2
|
#Source0: http://downloads.webmproject.org/releases/webm/%{name}-%{version}.tar.bz2
|
||||||
Source0: https://github.com/webmproject/libvpx/archive/v%{version}.tar.gz
|
Source0: https://github.com/webmproject/libvpx/archive/v%{version}.tar.gz
|
||||||
@ -23,6 +23,12 @@ BuildRequires: yasm
|
|||||||
BuildRequires: doxygen, php-cli, perl(Getopt::Long)
|
BuildRequires: doxygen, php-cli, perl(Getopt::Long)
|
||||||
# Do not disable FORTIFY_SOURCE=2
|
# Do not disable FORTIFY_SOURCE=2
|
||||||
Patch0: libvpx-1.7.0-leave-fortify-source-on.patch
|
Patch0: libvpx-1.7.0-leave-fortify-source-on.patch
|
||||||
|
# Patches were taken from and modified to apply cleanly:
|
||||||
|
# https://github.com/webmproject/libvpx/commit/263682c9a29395055f3b3afe2d97be1828a6223f
|
||||||
|
Patch1: 0001-Fix-bug-with-smaller-width-bigger-size.patch
|
||||||
|
# https://github.com/webmproject/libvpx/commit/3fbd1dca6a4d2dad332a2110d646e4ffef36d590
|
||||||
|
Patch2: 0002-VP8-disallow-thread-count-changes.patch
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
libvpx provides the VP8/VP9 SDK, which allows you to integrate your applications
|
libvpx provides the VP8/VP9 SDK, which allows you to integrate your applications
|
||||||
@ -48,6 +54,8 @@ and decoder.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n libvpx-%{version}
|
%setup -q -n libvpx-%{version}
|
||||||
%patch0 -p1 -b .leave-fs-on
|
%patch0 -p1 -b .leave-fs-on
|
||||||
|
%patch1 -p1 -b .bigger-size
|
||||||
|
%patch2 -p1 -b .disallow-thread
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -233,6 +241,10 @@ rm -rf %{buildroot}%{_prefix}/src
|
|||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 09 2023 Eduard Abdullin <eabdullin@almalinux.org> - 1.9.0-7.alma.1
|
||||||
|
- VP8: disallow thread count changes
|
||||||
|
- Fix bug with smaller width bigger size
|
||||||
|
|
||||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.9.0-5
|
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.9.0-5
|
||||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
Related: rhbz#1991688
|
Related: rhbz#1991688
|
||||||
|
Loading…
Reference in New Issue
Block a user