shithub: libvpx

Download patch

ref: d5054504a7ada94fa09557a4e787169e92ac0b16
parent: 1d2aaf58ddbb2bd6d78d02873274ad5bb50feb9a
author: Johann <johannkoenig@google.com>
date: Thu Sep 15 13:44:24 EDT 2016

zero structures completely

Use vp[89]_zero when possible.

Expand the {} set when neither is available or nearby.

Change-Id: Ifc1f46f60100916cd798bf7be3a10f09321c99bd

--- a/examples/simple_encoder.c
+++ b/examples/simple_encoder.c
@@ -150,7 +150,7 @@
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info = { 0, 0, 0, { 0, 0 } };
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   const int fps = 30;
--- a/examples/vp8cx_set_ref.c
+++ b/examples/vp8cx_set_ref.c
@@ -51,6 +51,7 @@
 
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_encoder.h"
+#include "vp8/common/common.h"
 
 #include "../tools_common.h"
 #include "../video_writer.h"
@@ -93,17 +94,21 @@
 
 int main(int argc, char **argv) {
   FILE *infile = NULL;
-  vpx_codec_ctx_t codec = { 0 };
-  vpx_codec_enc_cfg_t cfg = { 0 };
+  vpx_codec_ctx_t codec;
+  vpx_codec_enc_cfg_t cfg;
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   int update_frame_num = 0;
   const int fps = 30;       // TODO(dkovalev) add command line argument
   const int bitrate = 200;  // kbit/s TODO(dkovalev) add command line argument
+
+  vp8_zero(codec);
+  vp8_zero(cfg);
+  vp8_zero(info);
 
   exec_name = argv[0];
 
--- a/examples/vp9_lossless_encoder.c
+++ b/examples/vp9_lossless_encoder.c
@@ -14,6 +14,7 @@
 
 #include "vpx/vpx_encoder.h"
 #include "vpx/vp8cx.h"
+#include "vp9/common/vp9_common.h"
 
 #include "../tools_common.h"
 #include "../video_writer.h"
@@ -62,10 +63,12 @@
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   const int fps = 30;
+
+  vp9_zero(info);
 
   exec_name = argv[0];
 
--- a/examples/vp9cx_set_ref.c
+++ b/examples/vp9cx_set_ref.c
@@ -53,6 +53,7 @@
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_decoder.h"
 #include "vpx/vpx_encoder.h"
+#include "vp9/common/vp9_common.h"
 
 #include "./tools_common.h"
 #include "./video_writer.h"
@@ -277,12 +278,12 @@
 int main(int argc, char **argv) {
   FILE *infile = NULL;
   // Encoder
-  vpx_codec_ctx_t ecodec = { 0 };
-  vpx_codec_enc_cfg_t cfg = { 0 };
+  vpx_codec_ctx_t ecodec;
+  vpx_codec_enc_cfg_t cfg;
   unsigned int frame_in = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
 
@@ -304,6 +305,11 @@
   const char *infile_arg = NULL;
   const char *outfile_arg = NULL;
   unsigned int limit = 0;
+
+  vp9_zero(ecodec);
+  vp9_zero(cfg);
+  vp9_zero(info);
+
   exec_name = argv[0];
 
   if (argc < 6) die("Invalid number of arguments");
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -538,7 +538,7 @@
   unsigned int output_bit_depth = 0;
 #endif
 #if CONFIG_VP8_DECODER
-  vp8_postproc_cfg_t vp8_pp_cfg = { 0 };
+  vp8_postproc_cfg_t vp8_pp_cfg = { 0, 0, 0 };
   int vp8_dbg_color_ref_frame = 0;
   int vp8_dbg_color_mb_modes = 0;
   int vp8_dbg_color_b_modes = 0;