simple_encode.EndEncode();
}
+TEST(SimpleEncode, GetFramePixelCount) {
+ SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
+ target_bitrate, num_frames, infile_path);
+ EXPECT_EQ(simple_encode.GetFramePixelCount(),
+ static_cast<uint64_t>(w * h * 3 / 2));
+}
+
} // namespace
} // namespace vp9
multi_layer_arf, allow_alt_ref);
}
+uint64_t SimpleEncode::GetFramePixelCount() const {
+ assert(frame_width_ % 2 == 0);
+ assert(frame_heigh_ % 2 == 0);
+ switch (impl_ptr_->img_fmt) {
+ case VPX_IMG_FMT_I420: return frame_width_ * frame_height_ * 3 / 2;
+ case VPX_IMG_FMT_I422: return frame_width_ * frame_height_ * 2;
+ case VPX_IMG_FMT_I444: return frame_width_ * frame_height_ * 3;
+ case VPX_IMG_FMT_I440: return frame_width_ * frame_height_ * 2;
+ case VPX_IMG_FMT_I42016: return frame_width_ * frame_height_ * 3 / 2;
+ case VPX_IMG_FMT_I42216: return frame_width_ * frame_height_ * 2;
+ case VPX_IMG_FMT_I44416: return frame_width_ * frame_height_ * 3;
+ case VPX_IMG_FMT_I44016: return frame_width_ * frame_height_ * 2;
+ default: return 0;
+ }
+}
+
SimpleEncode::~SimpleEncode() {
if (this->file_ != NULL) {
fclose(this->file_);
// This function should be called after ComputeFirstPassStats().
int GetCodingFrameNum() const;
+ // Gets the total number of pixels of YUV planes per frame.
+ uint64_t GetFramePixelCount() const;
+
private:
class EncodeImpl;