| 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // is evenly divisble by 4, then the output will appear to have distinct | 35 // is evenly divisble by 4, then the output will appear to have distinct |
| 36 // columns, where one column will have motion and the next will not. | 36 // columns, where one column will have motion and the next will not. |
| 37 // | 37 // |
| 38 // The active map is cleared on frame 44. | 38 // The active map is cleared on frame 44. |
| 39 // | 39 // |
| 40 // Observing The Effects | 40 // Observing The Effects |
| 41 // --------------------- | 41 // --------------------- |
| 42 // Use the `simple_decoder` example to decode this sample, and observe | 42 // Use the `simple_decoder` example to decode this sample, and observe |
| 43 // the change in the image at frames 22, 33, and 44. | 43 // the change in the image at frames 22, 33, and 44. |
| 44 | 44 |
| 45 #include <assert.h> |
| 45 #include <stdio.h> | 46 #include <stdio.h> |
| 46 #include <stdlib.h> | 47 #include <stdlib.h> |
| 47 #include <string.h> | 48 #include <string.h> |
| 48 | 49 |
| 49 #define VPX_CODEC_DISABLE_COMPAT 1 | 50 #define VPX_CODEC_DISABLE_COMPAT 1 |
| 50 #include "vpx/vp8cx.h" | 51 #include "vpx/vp8cx.h" |
| 51 #include "vpx/vpx_encoder.h" | 52 #include "vpx/vpx_encoder.h" |
| 52 | 53 |
| 53 #include "./tools_common.h" | 54 #include "./tools_common.h" |
| 54 #include "./video_writer.h" | 55 #include "./video_writer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 const int fps = 2; // TODO(dkovalev) add command line argument | 171 const int fps = 2; // TODO(dkovalev) add command line argument |
| 171 const double bits_per_pixel_per_frame = 0.067; | 172 const double bits_per_pixel_per_frame = 0.067; |
| 172 | 173 |
| 173 exec_name = argv[0]; | 174 exec_name = argv[0]; |
| 174 if (argc != 6) | 175 if (argc != 6) |
| 175 die("Invalid number of arguments"); | 176 die("Invalid number of arguments"); |
| 176 | 177 |
| 177 memset(&info, 0, sizeof(info)); | 178 memset(&info, 0, sizeof(info)); |
| 178 | 179 |
| 179 encoder = get_vpx_encoder_by_name(argv[1]); | 180 encoder = get_vpx_encoder_by_name(argv[1]); |
| 180 if (!encoder) | 181 if (encoder == NULL) { |
| 181 die("Unsupported codec."); | 182 die("Unsupported codec."); |
| 182 | 183 } |
| 184 assert(encoder != NULL); |
| 183 info.codec_fourcc = encoder->fourcc; | 185 info.codec_fourcc = encoder->fourcc; |
| 184 info.frame_width = strtol(argv[2], NULL, 0); | 186 info.frame_width = strtol(argv[2], NULL, 0); |
| 185 info.frame_height = strtol(argv[3], NULL, 0); | 187 info.frame_height = strtol(argv[3], NULL, 0); |
| 186 info.time_base.numerator = 1; | 188 info.time_base.numerator = 1; |
| 187 info.time_base.denominator = fps; | 189 info.time_base.denominator = fps; |
| 188 | 190 |
| 189 if (info.frame_width <= 0 || | 191 if (info.frame_width <= 0 || |
| 190 info.frame_height <= 0 || | 192 info.frame_height <= 0 || |
| 191 (info.frame_width % 2) != 0 || | 193 (info.frame_width % 2) != 0 || |
| 192 (info.frame_height % 2) != 0) { | 194 (info.frame_height % 2) != 0) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 printf("Processed %d frames.\n", frame_count); | 247 printf("Processed %d frames.\n", frame_count); |
| 246 | 248 |
| 247 vpx_img_free(&raw); | 249 vpx_img_free(&raw); |
| 248 if (vpx_codec_destroy(&codec)) | 250 if (vpx_codec_destroy(&codec)) |
| 249 die_codec(&codec, "Failed to destroy codec."); | 251 die_codec(&codec, "Failed to destroy codec."); |
| 250 | 252 |
| 251 vpx_video_writer_close(writer); | 253 vpx_video_writer_close(writer); |
| 252 | 254 |
| 253 return EXIT_SUCCESS; | 255 return EXIT_SUCCESS; |
| 254 } | 256 } |
| OLD | NEW |