OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 |
11 | 11 |
12 // This is an example demonstrating multi-resolution encoding in VP8. | 12 // This is an example demonstrating multi-resolution encoding in VP8. |
13 // High-resolution input video is down-sampled to lower-resolutions. The | 13 // High-resolution input video is down-sampled to lower-resolutions. The |
14 // encoder then encodes the video and outputs multiple bitstreams with | 14 // encoder then encodes the video and outputs multiple bitstreams with |
15 // different resolutions. | 15 // different resolutions. |
16 // | 16 // |
17 // Configure with --enable-multi-res-encoding flag to enable this example. | 17 // Configure with --enable-multi-res-encoding flag to enable this example. |
18 | 18 |
19 #include <stdio.h> | 19 #include <stdio.h> |
20 #include <stdlib.h> | 20 #include <stdlib.h> |
21 #include <string.h> | 21 #include <string.h> |
22 | 22 |
23 #include "third_party/libyuv/include/libyuv/basic_types.h" | 23 #include "third_party/libyuv/include/libyuv/basic_types.h" |
24 #include "third_party/libyuv/include/libyuv/scale.h" | 24 #include "third_party/libyuv/include/libyuv/scale.h" |
25 #include "third_party/libyuv/include/libyuv/cpu_id.h" | 25 #include "third_party/libyuv/include/libyuv/cpu_id.h" |
26 | 26 |
27 #define VPX_CODEC_DISABLE_COMPAT 1 | |
28 #include "vpx/vpx_encoder.h" | 27 #include "vpx/vpx_encoder.h" |
29 #include "vpx/vp8cx.h" | 28 #include "vpx/vp8cx.h" |
30 | 29 |
31 #include "./tools_common.h" | 30 #include "./tools_common.h" |
32 #include "./video_writer.h" | 31 #include "./video_writer.h" |
33 | 32 |
34 // The input video frame is downsampled several times to generate a | 33 // The input video frame is downsampled several times to generate a |
35 // multi-level hierarchical structure. kNumEncoders is defined as the number | 34 // multi-level hierarchical structure. kNumEncoders is defined as the number |
36 // of encoding levels required. For example, if the size of input video is | 35 // of encoding levels required. For example, if the size of input video is |
37 // 1280x720, kNumEncoders is 3, and down-sampling factor is 2, the encoder | 36 // 1280x720, kNumEncoders is 3, and down-sampling factor is 2, the encoder |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (vpx_codec_destroy(&codec[i])) | 290 if (vpx_codec_destroy(&codec[i])) |
292 die_codec(&codec[i], "Failed to destroy codec"); | 291 die_codec(&codec[i], "Failed to destroy codec"); |
293 | 292 |
294 vpx_img_free(&raw[i]); | 293 vpx_img_free(&raw[i]); |
295 vpx_video_writer_close(writers[i]); | 294 vpx_video_writer_close(writers[i]); |
296 } | 295 } |
297 printf("\n"); | 296 printf("\n"); |
298 | 297 |
299 return EXIT_SUCCESS; | 298 return EXIT_SUCCESS; |
300 } | 299 } |
OLD | NEW |