| 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 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void Encoder::InitEncoder(VideoSource *video) { | 22 void Encoder::InitEncoder(VideoSource *video) { |
| 23 vpx_codec_err_t res; | 23 vpx_codec_err_t res; |
| 24 const vpx_image_t *img = video->img(); | 24 const vpx_image_t *img = video->img(); |
| 25 | 25 |
| 26 if (video->img() && !encoder_.priv) { | 26 if (video->img() && !encoder_.priv) { |
| 27 cfg_.g_w = img->d_w; | 27 cfg_.g_w = img->d_w; |
| 28 cfg_.g_h = img->d_h; | 28 cfg_.g_h = img->d_h; |
| 29 cfg_.g_timebase = video->timebase(); | 29 cfg_.g_timebase = video->timebase(); |
| 30 cfg_.rc_twopass_stats_in = stats_->buf(); | 30 cfg_.rc_twopass_stats_in = stats_->buf(); |
| 31 | 31 |
| 32 // Default to 1 thread and 1 tile column. | 32 // Default to 1 thread. |
| 33 cfg_.g_threads = 1; | 33 cfg_.g_threads = 1; |
| 34 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, | 34 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, |
| 35 init_flags_); | 35 init_flags_); |
| 36 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 36 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
| 37 | 37 |
| 38 std::string codec_name(encoder_.name); | 38 #if CONFIG_VP9_ENCODER |
| 39 if (codec_name.find("WebM Project VP9 Encoder") != std::string::npos) { | 39 if (CodecInterface() == &vpx_codec_vp9_cx_algo) { |
| 40 // Default to 1 tile column for VP9. |
| 40 const int log2_tile_columns = 0; | 41 const int log2_tile_columns = 0; |
| 41 res = vpx_codec_control_(&encoder_, VP9E_SET_TILE_COLUMNS, | 42 res = vpx_codec_control_(&encoder_, VP9E_SET_TILE_COLUMNS, |
| 42 log2_tile_columns); | 43 log2_tile_columns); |
| 43 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 44 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
| 45 } else |
| 46 #endif |
| 47 { |
| 48 #if CONFIG_VP8_ENCODER |
| 49 ASSERT_EQ(&vpx_codec_vp8_cx_algo, CodecInterface()) |
| 50 << "Unknown Codec Interface"; |
| 51 #endif |
| 44 } | 52 } |
| 45 } | 53 } |
| 46 } | 54 } |
| 47 | 55 |
| 48 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { | 56 void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { |
| 49 if (video->img()) | 57 if (video->img()) |
| 50 EncodeFrameInternal(*video, frame_flags); | 58 EncodeFrameInternal(*video, frame_flags); |
| 51 else | 59 else |
| 52 Flush(); | 60 Flush(); |
| 53 | 61 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (decoder) | 264 if (decoder) |
| 257 delete decoder; | 265 delete decoder; |
| 258 delete encoder; | 266 delete encoder; |
| 259 | 267 |
| 260 if (!Continue()) | 268 if (!Continue()) |
| 261 break; | 269 break; |
| 262 } | 270 } |
| 263 } | 271 } |
| 264 | 272 |
| 265 } // namespace libvpx_test | 273 } // namespace libvpx_test |
| OLD | NEW |