From 86394d2636a6f5540ad8557ec46092ac8da94a6e Mon Sep 17 00:00:00 2001
From: Minghai Shang <minghai@google.com>
Date: Fri, 28 Mar 2014 11:42:26 -0700
Subject: [PATCH] [svc] Fix SvcTest.SecondPassEncode failure

Root cause is the different default register length between x86
and x64 platform. Change spatial_layer_id to long long.

Change-Id: If1a5972365c7a59f7e76cb4fd714610f3d48a8ff
---
 test/test-data.sha1         | 2 +-
 vp9/encoder/vp9_firstpass.h | 2 +-
 vp9/encoder/vp9_onyx_if.c   | 4 ++--
 vp9/vp9_cx_iface.c          | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/test-data.sha1 b/test/test-data.sha1
index 981aa4ff63..1a6406b595 100644
--- a/test/test-data.sha1
+++ b/test/test-data.sha1
@@ -1,5 +1,5 @@
 d5dfb0151c9051f8c85999255645d7a23916d3c0  hantro_collage_w352h288.yuv
-2752863aa6330a93eaeb30f883310f87aa3de87c  hantro_collage_w352h288.stat
+998cec53307c94aa5835aaf8d5731f6a3c7c2e5a  hantro_collage_w352h288.stat
 b87815bf86020c592ccc7a846ba2e28ec8043902  hantro_odd.yuv
 b1f1c3ec79114b9a0651af24ce634afb44a9a419  rush_hour_444.y4m
 5184c46ddca8b1fadd16742e8500115bc8f749da  vp80-00-comprehensive-001.ivf
diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h
index bf7b5a1a1e..9268c38a82 100644
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -35,7 +35,7 @@ typedef struct {
   double new_mv_count;
   double duration;
   double count;
-  int spatial_layer_id;
+  int64_t spatial_layer_id;
 } FIRSTPASS_STATS;
 
 struct twopass_rc {
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index e30f5346a2..76b8c72838 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1767,7 +1767,7 @@ VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf) {
       for (i = 0; i < oxcf->ss_number_layers; ++i) {
         FIRSTPASS_STATS *const last_packet_for_layer =
             &stats[packets - oxcf->ss_number_layers + i];
-        const int layer_id = last_packet_for_layer->spatial_layer_id;
+        const int layer_id = (int)last_packet_for_layer->spatial_layer_id;
         const int packets_in_layer = (int)last_packet_for_layer->count + 1;
         if (layer_id >= 0 && layer_id < oxcf->ss_number_layers) {
           LAYER_CONTEXT *const lc = &cpi->svc.layer_context[layer_id];
@@ -1786,7 +1786,7 @@ VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf) {
       }
 
       for (i = 0; i < packets; ++i) {
-        const int layer_id = stats[i].spatial_layer_id;
+        const int layer_id = (int)stats[i].spatial_layer_id;
         if (layer_id >= 0 && layer_id < oxcf->ss_number_layers
             && stats_copy[layer_id] != NULL) {
           *stats_copy[layer_id] = stats[i];
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 84b61eba42..09e6b67815 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -227,7 +227,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t      *ctx,
 
       stats = cfg->rc_twopass_stats_in.buf;
       for (i = 0; i < n_packets; ++i) {
-        const int layer_id = stats[i].spatial_layer_id;
+        const int layer_id = (int)stats[i].spatial_layer_id;
         if (layer_id >= 0 && layer_id < (int)cfg->ss_number_layers) {
           ++n_packets_per_layer[layer_id];
         }
@@ -242,7 +242,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t      *ctx,
 
         stats = (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf +
                 n_packets - cfg->ss_number_layers + i;
-        layer_id = stats->spatial_layer_id;
+        layer_id = (int)stats->spatial_layer_id;
 
         if (layer_id >= cfg->ss_number_layers
             ||(int)(stats->count + 0.5) != n_packets_per_layer[layer_id] - 1)
-- 
GitLab