OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef TEST_VIDEO_SOURCE_H_ | 10 #ifndef TEST_VIDEO_SOURCE_H_ |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 virtual unsigned int limit() const { return limit_; } | 169 virtual unsigned int limit() const { return limit_; } |
170 | 170 |
171 void set_limit(unsigned int limit) { | 171 void set_limit(unsigned int limit) { |
172 limit_ = limit; | 172 limit_ = limit; |
173 } | 173 } |
174 | 174 |
175 void SetSize(unsigned int width, unsigned int height) { | 175 void SetSize(unsigned int width, unsigned int height) { |
176 if (width != width_ || height != height_) { | 176 if (width != width_ || height != height_) { |
177 vpx_img_free(img_); | 177 vpx_img_free(img_); |
178 raw_sz_ = ((width + 31)&~31) * height * 3 / 2; | |
179 img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 32); | 178 img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 32); |
| 179 raw_sz_ = ((img_->w + 31) & ~31) * img_->h * 3 / 2; |
180 width_ = width; | 180 width_ = width; |
181 height_ = height; | 181 height_ = height; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 protected: | 185 protected: |
186 virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); } | 186 virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); } |
187 | 187 |
188 vpx_image_t *img_; | 188 vpx_image_t *img_; |
189 size_t raw_sz_; | 189 size_t raw_sz_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 virtual const uint8_t *cxdata() const = 0; | 241 virtual const uint8_t *cxdata() const = 0; |
242 | 242 |
243 virtual size_t frame_size() const = 0; | 243 virtual size_t frame_size() const = 0; |
244 | 244 |
245 virtual unsigned int frame_number() const = 0; | 245 virtual unsigned int frame_number() const = 0; |
246 }; | 246 }; |
247 | 247 |
248 } // namespace libvpx_test | 248 } // namespace libvpx_test |
249 | 249 |
250 #endif // TEST_VIDEO_SOURCE_H_ | 250 #endif // TEST_VIDEO_SOURCE_H_ |
OLD | NEW |