shithub: libvpx

Download patch

ref: 19d2e73dea451c1f152ae9c98cee21017f42bd93
parent: ba42ce64b7d838f2ebc2227a6b43e06ba081e4b9
parent: 7104833085d984ef6e89253ad137bbbcbcfe3936
author: James Zern <jzern@google.com>
date: Fri Aug 5 21:20:52 EDT 2016

Merge changes Ice037acb,I806af11b,I344a7dd0,Ib7cb87fa

* changes:
  vp9: normalize vpx_enc_frame_flags_t usage
  args.c: add some explicit casts
  webmdec: quiet -Wshorten-64-to-32 warning
  test/decode_test_driver: rm unused deadline member

--- a/args.c
+++ b/args.c
@@ -124,7 +124,7 @@
   rawval = strtol(arg->val, &endptr, 10);
 
   if (arg->val[0] != '\0' && endptr[0] == '\0') {
-    if (rawval >= 0 && rawval <= UINT_MAX) return rawval;
+    if (rawval >= 0 && rawval <= UINT_MAX) return (unsigned int)rawval;
 
     die("Option %s: Value %ld out of range for unsigned int\n", arg->name,
         rawval);
@@ -141,7 +141,7 @@
   rawval = strtol(arg->val, &endptr, 10);
 
   if (arg->val[0] != '\0' && endptr[0] == '\0') {
-    if (rawval >= INT_MIN && rawval <= INT_MAX) return rawval;
+    if (rawval >= INT_MIN && rawval <= INT_MAX) return (int)rawval;
 
     die("Option %s: Value %ld out of range for signed int\n", arg->name,
         rawval);
@@ -165,7 +165,7 @@
 
   if (arg->val[0] != '\0' && endptr[0] == '/') {
     if (rawval >= INT_MIN && rawval <= INT_MAX)
-      rat.num = rawval;
+      rat.num = (int)rawval;
     else
       die("Option %s: Value %ld out of range for signed int\n", arg->name,
           rawval);
@@ -177,7 +177,7 @@
 
   if (arg->val[0] != '\0' && endptr[0] == '\0') {
     if (rawval >= INT_MIN && rawval <= INT_MAX)
-      rat.den = rawval;
+      rat.den = (int)rawval;
     else
       die("Option %s: Value %ld out of range for signed int\n", arg->name,
           rawval);
@@ -197,7 +197,7 @@
   if (arg->val[0] != '\0' && endptr[0] == '\0') {
     /* Got a raw value, make sure it's valid */
     for (listptr = arg->def->enums; listptr->name; listptr++)
-      if (listptr->val == rawval) return rawval;
+      if (listptr->val == rawval) return (int)rawval;
   }
 
   /* Next see if it can be parsed as a string */
--- a/test/codec_factory.h
+++ b/test/codec_factory.h
@@ -32,13 +32,10 @@
 
   virtual ~CodecFactory() {}
 
-  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 unsigned long deadline) const = 0;
+  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const = 0;
 
   virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 const vpx_codec_flags_t flags,
-                                 unsigned long deadline)  // NOLINT(runtime/int)
-      const = 0;
+                                 const vpx_codec_flags_t flags) const = 0;
 
   virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
                                  unsigned long deadline,
@@ -74,12 +71,10 @@
 #if CONFIG_VP8
 class VP8Decoder : public Decoder {
  public:
-  VP8Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
-      : Decoder(cfg, deadline) {}
+  explicit VP8Decoder(vpx_codec_dec_cfg_t cfg) : Decoder(cfg) {}
 
-  VP8Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
-             unsigned long deadline)  // NOLINT
-      : Decoder(cfg, flag, deadline) {}
+  VP8Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag)
+      : Decoder(cfg, flag) {}
 
  protected:
   virtual vpx_codec_iface_t *CodecInterface() const {
@@ -111,16 +106,14 @@
  public:
   VP8CodecFactory() : CodecFactory() {}
 
-  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 unsigned long deadline) const {
-    return CreateDecoder(cfg, 0, deadline);
+  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
+    return CreateDecoder(cfg, 0);
   }
 
   virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 const vpx_codec_flags_t flags,
-                                 unsigned long deadline) const {  // NOLINT
+                                 const vpx_codec_flags_t flags) const {
 #if CONFIG_VP8_DECODER
-    return new VP8Decoder(cfg, flags, deadline);
+    return new VP8Decoder(cfg, flags);
 #else
     return NULL;
 #endif
@@ -166,12 +159,10 @@
 #if CONFIG_VP9
 class VP9Decoder : public Decoder {
  public:
-  VP9Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
-      : Decoder(cfg, deadline) {}
+  explicit VP9Decoder(vpx_codec_dec_cfg_t cfg) : Decoder(cfg) {}
 
-  VP9Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
-             unsigned long deadline)  // NOLINT
-      : Decoder(cfg, flag, deadline) {}
+  VP9Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag)
+      : Decoder(cfg, flag) {}
 
  protected:
   virtual vpx_codec_iface_t *CodecInterface() const {
@@ -203,16 +194,14 @@
  public:
   VP9CodecFactory() : CodecFactory() {}
 
-  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 unsigned long deadline) const {
-    return CreateDecoder(cfg, 0, deadline);
+  virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
+    return CreateDecoder(cfg, 0);
   }
 
   virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
-                                 const vpx_codec_flags_t flags,
-                                 unsigned long deadline) const {  // NOLINT
+                                 const vpx_codec_flags_t flags) const {
 #if CONFIG_VP9_DECODER
-    return new VP9Decoder(cfg, flags, deadline);
+    return new VP9Decoder(cfg, flags);
 #else
     return NULL;
 #endif
--- a/test/decode_test_driver.cc
+++ b/test/decode_test_driver.cc
@@ -65,7 +65,7 @@
 
 void DecoderTest::RunLoop(CompressedVideoSource *video,
                           const vpx_codec_dec_cfg_t &dec_cfg) {
-  Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_, 0);
+  Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_);
   ASSERT_TRUE(decoder != NULL);
   bool end_of_file = false;
 
--- a/test/decode_test_driver.h
+++ b/test/decode_test_driver.h
@@ -38,17 +38,13 @@
 // as more tests are added.
 class Decoder {
  public:
-  Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
-      : cfg_(cfg), flags_(0), deadline_(deadline), init_done_(false) {
+  explicit Decoder(vpx_codec_dec_cfg_t cfg)
+      : cfg_(cfg), flags_(0), init_done_(false) {
     memset(&decoder_, 0, sizeof(decoder_));
   }
 
-  Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
-          unsigned long deadline)  // NOLINT
-      : cfg_(cfg),
-        flags_(flag),
-        deadline_(deadline),
-        init_done_(false) {
+  Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag)
+      : cfg_(cfg), flags_(flag), init_done_(false) {
     memset(&decoder_, 0, sizeof(decoder_));
   }
 
@@ -64,8 +60,6 @@
 
   DxDataIterator GetDxData() { return DxDataIterator(&decoder_); }
 
-  void set_deadline(unsigned long deadline) { deadline_ = deadline; }
-
   void Control(int ctrl_id, int arg) { Control(ctrl_id, arg, VPX_CODEC_OK); }
 
   void Control(int ctrl_id, const void *arg) {
@@ -117,7 +111,6 @@
   vpx_codec_ctx_t decoder_;
   vpx_codec_dec_cfg_t cfg_;
   vpx_codec_flags_t flags_;
-  unsigned int deadline_;
   bool init_done_;
 };
 
--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -185,7 +185,7 @@
     if (init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION)
       dec_init_flags |= VPX_CODEC_USE_INPUT_FRAGMENTS;
     testing::internal::scoped_ptr<Decoder> decoder(
-        codec_->CreateDecoder(dec_cfg, dec_init_flags, 0));
+        codec_->CreateDecoder(dec_cfg, dec_init_flags));
     bool again;
     for (again = true; again; video->Next()) {
       again = (video->img() != NULL);
--- a/test/vp9_frame_parallel_test.cc
+++ b/test/vp9_frame_parallel_test.cc
@@ -50,7 +50,7 @@
   cfg.threads = num_threads;
   vpx_codec_flags_t flags = 0;
   flags |= VPX_CODEC_USE_FRAME_THREADING;
-  libvpx_test::VP9Decoder decoder(cfg, flags, 0);
+  libvpx_test::VP9Decoder decoder(cfg, flags);
 
   libvpx_test::MD5 md5;
   video.Begin();
@@ -136,7 +136,7 @@
   vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
   cfg.threads = num_threads;
   const vpx_codec_flags_t flags = VPX_CODEC_USE_FRAME_THREADING;
-  libvpx_test::VP9Decoder decoder(cfg, flags, 0);
+  libvpx_test::VP9Decoder decoder(cfg, flags);
 
   libvpx_test::MD5 md5;
   video.Begin();
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4051,7 +4051,7 @@
   }
 }
 
-int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
+int vp9_receive_raw_frame(VP9_COMP *cpi, vpx_enc_frame_flags_t frame_flags,
                           YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time) {
   VP9_COMMON *const cm = &cpi->common;
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -602,7 +602,7 @@
 
 // receive a frames worth of data. caller can assume that a copy of this
 // frame is made and not just a copy of the pointer..
-int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
+int vp9_receive_raw_frame(VP9_COMP *cpi, vpx_enc_frame_flags_t frame_flags,
                           YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time_stamp);
 
--- a/vp9/encoder/vp9_lookahead.c
+++ b/vp9/encoder/vp9_lookahead.c
@@ -87,7 +87,7 @@
 #if CONFIG_VP9_HIGHBITDEPTH
                        int use_highbitdepth,
 #endif
-                       unsigned int flags) {
+                       vpx_enc_frame_flags_t flags) {
   struct lookahead_entry *buf;
 #if USE_PARTIAL_COPY
   int row, col, active_end;
--- a/vp9/encoder/vp9_lookahead.h
+++ b/vp9/encoder/vp9_lookahead.h
@@ -12,11 +12,11 @@
 #define VP9_ENCODER_VP9_LOOKAHEAD_H_
 
 #include "vpx_scale/yv12config.h"
+#include "vpx/vpx_encoder.h"
 #include "vpx/vpx_integer.h"
 
 #if CONFIG_SPATIAL_SVC
 #include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
 #endif
 
 #ifdef __cplusplus
@@ -29,7 +29,7 @@
   YV12_BUFFER_CONFIG img;
   int64_t ts_start;
   int64_t ts_end;
-  unsigned int flags;
+  vpx_enc_frame_flags_t flags;
 };
 
 // The max of past frames we want to keep in the queue.
@@ -81,7 +81,7 @@
 #if CONFIG_VP9_HIGHBITDEPTH
                        int use_highbitdepth,
 #endif
-                       unsigned int flags);
+                       vpx_enc_frame_flags_t flags);
 
 /**\brief Get the next source buffer to encode
  *
--- a/webmdec.cc
+++ b/webmdec.cc
@@ -89,7 +89,7 @@
     const mkvparser::Track *const track = tracks->GetTrackByIndex(i);
     if (track->GetType() == mkvparser::Track::kVideo) {
       video_track = static_cast<const mkvparser::VideoTrack *>(track);
-      webm_ctx->video_track_index = track->GetNumber();
+      webm_ctx->video_track_index = static_cast<int>(track->GetNumber());
       break;
     }
   }