shithub: libvpx

Download patch

ref: b8bc2d337a6f4b480ae7923e85a928faa2191ba2
parent: 17d2394c43b6bef5b767a6f3e7f53398070c02ae
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Mar 18 06:47:51 EDT 2014

Fixing warnings/errors from c++ compiler.

Change-Id: Ia561dda53f2dd10e3a10a2df2adb8027ab19397a

--- a/vp9/common/vp9_debugmodes.c
+++ b/vp9/common/vp9_debugmodes.c
@@ -22,7 +22,7 @@
  * and uses the passed in member offset to print out the value of an integer
  * for each mbmi member value in the mi structure.
  */
-static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor,
+static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor,
                           size_t member_offset) {
   int mi_row;
   int mi_col;
@@ -47,7 +47,7 @@
   }
   fprintf(file, "\n");
 }
-void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) {
+void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) {
   int mi_row;
   int mi_col;
   int mi_index = 0;
--- a/vp9/common/vp9_entropymv.c
+++ b/vp9/common/vp9_entropymv.c
@@ -122,12 +122,8 @@
 };
 
 MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
-  MV_CLASS_TYPE c = MV_CLASS_0;
-  if (z >= CLASS0_SIZE * 4096)
-    c = MV_CLASS_10;
-  else
-    c = log_in_base_2[z >> 3];
-
+  const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096) ? MV_CLASS_10 :
+                              (MV_CLASS_TYPE)log_in_base_2[z >> 3];
   if (offset)
     *offset = z - mv_class_base(c);
   return c;
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -63,7 +63,7 @@
                                      TX_SIZE max_tx_size, vp9_reader *r) {
   const int ctx = vp9_get_tx_size_context(xd);
   const vp9_prob *tx_probs = get_tx_probs(max_tx_size, ctx, &cm->fc.tx_probs);
-  TX_SIZE tx_size = vp9_read(r, tx_probs[0]);
+  TX_SIZE tx_size = (TX_SIZE)vp9_read(r, tx_probs[0]);
   if (tx_size != TX_4X4 && max_tx_size >= TX_16X16) {
     tx_size += vp9_read(r, tx_probs[1]);
     if (tx_size != TX_8X8 && max_tx_size >= TX_32X32)
@@ -258,7 +258,8 @@
                                                 vp9_reader *r) {
   if (cm->reference_mode == REFERENCE_MODE_SELECT) {
     const int ctx = vp9_get_reference_mode_context(cm, xd);
-    const int mode = vp9_read(r, cm->fc.comp_inter_prob[ctx]);
+    const REFERENCE_MODE mode =
+        (REFERENCE_MODE)vp9_read(r, cm->fc.comp_inter_prob[ctx]);
     if (!cm->frame_parallel_decoding_mode)
       ++cm->counts.comp_inter[ctx][mode];
     return mode;  // SINGLE_REFERENCE or COMPOUND_REFERENCE
@@ -314,8 +315,9 @@
 static INLINE INTERP_FILTER read_switchable_interp_filter(
     VP9_COMMON *const cm, MACROBLOCKD *const xd, vp9_reader *r) {
   const int ctx = vp9_get_pred_context_switchable_interp(xd);
-  const int type = vp9_read_tree(r, vp9_switchable_interp_tree,
-                                 cm->fc.switchable_interp_prob[ctx]);
+  const INTERP_FILTER type =
+      (INTERP_FILTER)vp9_read_tree(r, vp9_switchable_interp_tree,
+                                   cm->fc.switchable_interp_prob[ctx]);
   if (!cm->frame_parallel_decoding_mode)
     ++cm->counts.switchable_interp[ctx][type];
   return type;
@@ -465,7 +467,7 @@
     const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];  // 1 or 2
     const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];  // 1 or 2
     int idx, idy;
-    int b_mode;
+    MB_PREDICTION_MODE b_mode;
     int_mv nearest_sub8x8[2], near_sub8x8[2];
     for (idy = 0; idy < 2; idy += num_4x4_h) {
       for (idx = 0; idx < 2; idx += num_4x4_w) {
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -36,7 +36,7 @@
   unsigned int                rc_max_intra_bitrate_pct;
   unsigned int                lossless;
   unsigned int                frame_parallel_decoding_mode;
-  unsigned int                aq_mode;
+  AQ_MODE                     aq_mode;
 };
 
 struct extraconfig_map {
@@ -59,12 +59,12 @@
       7,                          /* arnr_max_frames */
       5,                          /* arnr_strength */
       3,                          /* arnr_type*/
-      0,                          /* tuning*/
+      VP8_TUNE_PSNR,              /* tuning*/
       10,                         /* cq_level */
       0,                          /* rc_max_intra_bitrate_pct */
       0,                          /* lossless */
       0,                          /* frame_parallel_decoding_mode */
-      0,                          /* aq_mode */
+      NO_AQ,                      /* aq_mode */
     }
   }
 };
@@ -217,7 +217,7 @@
   if (cfg->g_pass == VPX_RC_LAST_PASS) {
     size_t           packet_sz = sizeof(FIRSTPASS_STATS);
     int              n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz);
-    FIRSTPASS_STATS *stats;
+    const FIRSTPASS_STATS *stats;
 
     if (cfg->rc_twopass_stats_in.buf == NULL)
       ERROR("rc_twopass_stats_in.buf not set.");
@@ -228,8 +228,8 @@
     if (cfg->rc_twopass_stats_in.sz < 2 * packet_sz)
       ERROR("rc_twopass_stats_in requires at least two packets.");
 
-    stats = (void *)((char *)cfg->rc_twopass_stats_in.buf
-                     + (n_packets - 1) * packet_sz);
+    stats =
+        (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf + n_packets - 1;
 
     if ((int)(stats->count + 0.5) != n_packets - 1)
       ERROR("rc_twopass_stats_in missing EOS stats packet");
@@ -529,7 +529,7 @@
 
     if (priv->cx_data_sz < 4096) priv->cx_data_sz = 4096;
 
-    priv->cx_data = malloc(priv->cx_data_sz);
+    priv->cx_data = (unsigned char *)malloc(priv->cx_data_sz);
 
     if (priv->cx_data == NULL) return VPX_CODEC_MEM_ERROR;
 
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -80,10 +80,10 @@
 static void vp9_init_ctx(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap) {
   int i;
 
-  ctx->priv = mmap->base;
+  ctx->priv = (vpx_codec_priv_t *)mmap->base;
   ctx->priv->sz = sizeof(*ctx->priv);
   ctx->priv->iface = ctx->iface;
-  ctx->priv->alg_priv = mmap->base;
+  ctx->priv->alg_priv = (struct vpx_codec_alg_priv *)mmap->base;
 
   for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++)
     ctx->priv->alg_priv->mmaps[i].id = vp9_mem_req_segs[i].id;
@@ -406,7 +406,7 @@
                                   long                   deadline) {
   const uint8_t *data_start = data;
   const uint8_t *data_end = data + data_sz;
-  vpx_codec_err_t res = 0;
+  vpx_codec_err_t res = VPX_CODEC_OK;
   uint32_t sizes[8];
   int frames_this_pts, frame_count = 0;
 
@@ -502,7 +502,7 @@
                                         vpx_codec_mmap_t *mmap,
                                         vpx_codec_iter_t *iter) {
   vpx_codec_err_t res;
-  const mem_req_t *seg_iter = *iter;
+  const mem_req_t *seg_iter = (const mem_req_t *)*iter;
 
   /* Get address of next segment request */
   do {