Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: source/libvpx/test/video_source.h

Issue 898943004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/test/test_vectors.cc ('k') | source/libvpx/test/vp9_avg_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/test/video_source.h
diff --git a/source/libvpx/test/video_source.h b/source/libvpx/test/video_source.h
index b97e1550e2f3af786ad47ca152bc5ba97e66ad7b..63294d14ae07e2debacae1a87cd61d7a865c12ba 100644
--- a/source/libvpx/test/video_source.h
+++ b/source/libvpx/test/video_source.h
@@ -134,8 +134,13 @@ class VideoSource {
class DummyVideoSource : public VideoSource {
public:
- DummyVideoSource() : img_(NULL), limit_(100), width_(0), height_(0) {
- SetSize(80, 64);
+ DummyVideoSource()
+ : img_(NULL),
+ limit_(100),
+ width_(80),
+ height_(64),
+ format_(VPX_IMG_FMT_I420) {
+ ReallocImage();
}
virtual ~DummyVideoSource() { vpx_img_free(img_); }
@@ -174,23 +179,35 @@ class DummyVideoSource : public VideoSource {
void SetSize(unsigned int width, unsigned int height) {
if (width != width_ || height != height_) {
- vpx_img_free(img_);
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 32);
- raw_sz_ = ((img_->w + 31) & ~31) * img_->h * 3 / 2;
width_ = width;
height_ = height;
+ ReallocImage();
+ }
+ }
+
+ void SetImageFormat(vpx_img_fmt_t format) {
+ if (format_ != format) {
+ format_ = format;
+ ReallocImage();
}
}
protected:
virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); }
+ void ReallocImage() {
+ vpx_img_free(img_);
+ img_ = vpx_img_alloc(NULL, format_, width_, height_, 32);
+ raw_sz_ = ((img_->w + 31) & ~31) * img_->h * img_->bps / 8;
+ }
+
vpx_image_t *img_;
size_t raw_sz_;
unsigned int limit_;
unsigned int frame_;
unsigned int width_;
unsigned int height_;
+ vpx_img_fmt_t format_;
};
« no previous file with comments | « source/libvpx/test/test_vectors.cc ('k') | source/libvpx/test/vp9_avg_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698