[vlc-commits] contrib: aom: fix leak when film grain is applied

Steve Lhomme git at videolan.org
Thu Sep 13 10:28:59 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 13 10:19:51 2018 +0200| [72b2f55edfceca76aa03e4eefd6c04c381eecd54] | committer: Steve Lhomme

contrib: aom: fix leak when film grain is applied

The image when the film-grain is applied is supposed to end up in
ctx->image_with_grain so it's not relocated everytime but it wasn't kept.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72b2f55edfceca76aa03e4eefd6c04c381eecd54
---

 contrib/src/aom/aom-film-grain-leak.patch | 22 ++++++++++++++++++++++
 contrib/src/aom/rules.mak                 |  1 +
 2 files changed, 23 insertions(+)

diff --git a/contrib/src/aom/aom-film-grain-leak.patch b/contrib/src/aom/aom-film-grain-leak.patch
new file mode 100644
index 0000000000..642e6b3985
--- /dev/null
+++ b/contrib/src/aom/aom-film-grain-leak.patch
@@ -0,0 +1,22 @@
+--- aom/av1/av1_dx_iface.c.grain_leak	2018-09-13 10:16:19.944607200 +0200
++++ aom/av1/av1_dx_iface.c	2018-09-13 10:14:57.707231900 +0200
+@@ -618,6 +618,7 @@ aom_image_t *add_grain_if_needed(aom_ima
+ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
+                                       aom_codec_iter_t *iter) {
+   aom_image_t *img = NULL;
++  aom_image_t *decoded = NULL;
+ 
+   if (!iter) {
+     return NULL;
+@@ -704,7 +705,10 @@ static aom_image_t *decoder_get_frame(ao
+           img = &ctx->img;
+           img->temporal_id = cm->temporal_layer_id;
+           img->spatial_id = cm->spatial_layer_id;
+-          return add_grain_if_needed(img, ctx->image_with_grain, grain_params);
++          decoded = add_grain_if_needed(img, ctx->image_with_grain, grain_params);
++          if (decoded != img)
++              ctx->image_with_grain = decoded;
++          return decoded;
+         }
+       } else {
+         // Decoding failed. Release the worker thread.
diff --git a/contrib/src/aom/rules.mak b/contrib/src/aom/rules.mak
index 9aee683d69..800b5a4ee0 100644
--- a/contrib/src/aom/rules.mak
+++ b/contrib/src/aom/rules.mak
@@ -20,6 +20,7 @@ aom: aom-$(AOM_VERSION).tar.gz .sum-aom
 	mkdir -p $@-$(AOM_VERSION)
 	tar xvzf "$<" -C $@-$(AOM_VERSION)
 	$(APPLY) $(SRC)/aom/film-grain-copy-the-user_priv-from-the-img.patch
+	$(APPLY) $(SRC)/aom/aom-film-grain-leak.patch
 ifdef HAVE_WINSTORE
 	$(APPLY) $(SRC)/aom/aom-pthreads-win32.patch
 endif



More information about the vlc-commits mailing list