shithub: libvpx

Download patch

ref: 91f8be5045bf9fdfb59106390fd6b4c85e711452
parent: a3171b107ae4caa4ad0aa8df6213d9d0144328ca
author: angiebird <angiebird@google.com>
date: Thu Feb 6 13:15:02 EST 2020

Replace NULL by nullptr in simple_encode.c/h

Change-Id: Ib68740a02be852d03a3a2ad4d9d4a7d84d537590

--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -570,12 +570,12 @@
   num_frames_ = num_frames;
   // TODO(angirbid): Should we keep a file pointer here or keep the file_path?
   in_file_ = fopen(infile_path, "r");
-  if (outfile_path != NULL) {
+  if (outfile_path != nullptr) {
     out_file_ = fopen(outfile_path, "w");
   } else {
-    out_file_ = NULL;
+    out_file_ = nullptr;
   }
-  impl_ptr_->cpi = NULL;
+  impl_ptr_->cpi = nullptr;
   impl_ptr_->img_fmt = VPX_IMG_FMT_I420;
 }
 
@@ -616,7 +616,7 @@
         ENCODE_FRAME_RESULT encode_frame_info;
         vp9_init_encode_frame_result(&encode_frame_info);
         // TODO(angiebird): Call vp9_first_pass directly
-        vp9_get_compressed_data(cpi, &frame_flags, &size, NULL, &time_stamp,
+        vp9_get_compressed_data(cpi, &frame_flags, &size, nullptr, &time_stamp,
                                 &time_end, flush, &encode_frame_info);
         // vp9_get_compressed_data only generates first pass stats not
         // compresses data
@@ -668,7 +668,7 @@
              impl_ptr_->first_pass_stats.size();
 
   vp9_set_first_pass_stats(&oxcf, &stats);
-  assert(impl_ptr_->cpi == NULL);
+  assert(impl_ptr_->cpi == nullptr);
   impl_ptr_->cpi = init_encoder(&oxcf, impl_ptr_->img_fmt);
   vpx_img_alloc(&impl_ptr_->tmp_img, impl_ptr_->img_fmt, frame_width_,
                 frame_height_, 1);
@@ -675,7 +675,7 @@
   UpdateGroupOfPicture(impl_ptr_->cpi, &group_of_picture_);
   rewind(in_file_);
 
-  if (out_file_ != NULL) {
+  if (out_file_ != nullptr) {
     const char *fourcc = "VP90";
     vpx_rational_t time_base = invert_vpx_rational(frame_rate);
     ivf_write_file_header_with_video_info(out_file_, *(const uint32_t *)fourcc,
@@ -750,7 +750,7 @@
                             &encode_frame_result->coding_data_byte_size,
                             encode_frame_result->coding_data.get(), &time_stamp,
                             &time_end, flush, &encode_frame_info);
-    if (out_file_ != NULL) {
+    if (out_file_ != nullptr) {
       ivf_write_frame_header(out_file_, time_stamp,
                              encode_frame_result->coding_data_byte_size);
       fwrite(encode_frame_result->coding_data.get(), 1,
@@ -826,10 +826,10 @@
 }
 
 SimpleEncode::~SimpleEncode() {
-  if (in_file_ != NULL) {
+  if (in_file_ != nullptr) {
     fclose(in_file_);
   }
-  if (out_file_ != NULL) {
+  if (out_file_ != nullptr) {
     fclose(out_file_);
   }
 }
--- a/vp9/simple_encode.h
+++ b/vp9/simple_encode.h
@@ -243,7 +243,7 @@
   // format.
   SimpleEncode(int frame_width, int frame_height, int frame_rate_num,
                int frame_rate_den, int target_bitrate, int num_frames,
-               const char *infile_path, const char *outfile_path = NULL);
+               const char *infile_path, const char *outfile_path = nullptr);
   ~SimpleEncode();
   SimpleEncode(SimpleEncode &) = delete;
   SimpleEncode &operator=(const SimpleEncode &) = delete;