ref: 22b23e4d98a363cc94ec38c18ddb4940066cf76a
parent: d53645f4982bca27ec69ef41004c3d72ad1f6f22
author: Cheng Chen <chengchen@google.com>
date: Tue Jan 28 04:58:42 EST 2020
Change partition_info to a vector Change-Id: Ia59229da51671045448ea904ed65026155868993
--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -353,7 +353,7 @@
update_partition_info(encode_frame_info->partition_info,
encode_frame_result->num_rows_4x4,
encode_frame_result->num_cols_4x4,
- encode_frame_result->partition_info.get());
+ &encode_frame_result->partition_info[0]);
update_frame_counts(&encode_frame_info->frame_counts,
&encode_frame_result->frame_counts);
}
@@ -591,9 +591,7 @@
std::unique_ptr<uint8_t[]>(new uint8_t[max_coding_data_byte_size]));
encode_frame_result->num_rows_4x4 = num_rows_4x4_;
encode_frame_result->num_cols_4x4 = num_cols_4x4_;
- encode_frame_result->partition_info =
- std::move(std::unique_ptr<PartitionInfo[]>(
- new PartitionInfo[num_rows_4x4_ * num_cols_4x4_]));
+ encode_frame_result->partition_info.resize(num_rows_4x4_ * num_cols_4x4_);
int64_t time_stamp;
int64_t time_end;
int flush = 1; // Make vp9_get_compressed_data encode a frame
--- a/vp9/simple_encode.h
+++ b/vp9/simple_encode.h
@@ -144,12 +144,16 @@
FrameCounts frame_counts;
int num_rows_4x4; // number of row units, in size of 4.
int num_cols_4x4; // number of column units, in size of 4.
- // The pointer to the partition information of the frame.
+ // A vector of the partition information of the frame.
+ // The number of elements is |num_rows_4x4| * |num_cols_4x4|.
// The frame is divided 4x4 blocks of |num_rows_4x4| rows and
// |num_cols_4x4| columns.
// Each 4x4 block contains the current pixel position (|row|, |column|),
// the start pixel position of the partition (|row_start|, |column_start|),
// and the |width|, |height| of the partition.
+ // The current pixel position can be the same as the start pixel position
+ // if the 4x4 block is the top-left block in the partition. Otherwise, they
+ // are different.
// Within the same partition, all 4x4 blocks have the same |row_start|,
// |column_start|, |width| and |height|.
// For example, if the frame is partitioned to a 32x32 block,
@@ -159,7 +163,7 @@
// the start of the next partition block.
// Horizontal next: |column_start| + |width|,
// Vertical next: |row_start| + |height|.
- std::unique_ptr<PartitionInfo[]> partition_info;
+ std::vector<PartitionInfo> partition_info;
};
struct GroupOfPicture {