Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 10 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 11 | * Based on code from the OggTheora software codec source code, |
| 12 | * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors. |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 13 | */ |
James Zern | 0f51278 | 2013-12-15 18:40:23 -0800 | [diff] [blame] | 14 | |
| 15 | #ifndef Y4MINPUT_H_ |
| 16 | #define Y4MINPUT_H_ |
| 17 | |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 18 | #include <stdio.h> |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 19 | #include "aom/aom_image.h" |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 20 | |
James Zern | 25cfd8e | 2014-01-18 12:16:11 -0800 | [diff] [blame] | 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 25 | typedef struct y4m_input y4m_input; |
| 26 | |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 27 | /*The function used to perform chroma conversion.*/ |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 28 | typedef void (*y4m_convert_func)(y4m_input *_y4m, unsigned char *_dst, |
| 29 | unsigned char *_src); |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 30 | |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 31 | struct y4m_input { |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 32 | int pic_w; |
| 33 | int pic_h; |
| 34 | int fps_n; |
| 35 | int fps_d; |
| 36 | int par_n; |
| 37 | int par_d; |
| 38 | char interlace; |
| 39 | int src_c_dec_h; |
| 40 | int src_c_dec_v; |
| 41 | int dst_c_dec_h; |
| 42 | int dst_c_dec_v; |
| 43 | char chroma_type[16]; |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 44 | /*The size of each converted frame buffer.*/ |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 45 | size_t dst_buf_sz; |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 46 | /*The amount to read directly into the converted frame buffer.*/ |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 47 | size_t dst_buf_read_sz; |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 48 | /*The size of the auxilliary buffer.*/ |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 49 | size_t aux_buf_sz; |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 50 | /*The amount to read into the auxilliary buffer.*/ |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 51 | size_t aux_buf_read_sz; |
| 52 | y4m_convert_func convert; |
| 53 | unsigned char *dst_buf; |
| 54 | unsigned char *aux_buf; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 55 | enum aom_img_fmt aom_fmt; |
clang-format | 6c4d83e | 2016-08-08 19:03:30 -0700 | [diff] [blame] | 56 | int bps; |
| 57 | unsigned int bit_depth; |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 58 | }; |
| 59 | |
John Koleszar | 8dd8287 | 2013-05-06 11:01:35 -0700 | [diff] [blame] | 60 | int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip, |
| 61 | int only_420); |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 62 | void y4m_input_close(y4m_input *_y4m); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 63 | int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, aom_image_t *img); |
Timothy B. Terriberry | 44d8949 | 2010-05-26 18:27:51 -0400 | [diff] [blame] | 64 | |
James Zern | 25cfd8e | 2014-01-18 12:16:11 -0800 | [diff] [blame] | 65 | #ifdef __cplusplus |
| 66 | } // extern "C" |
| 67 | #endif |
| 68 | |
James Zern | 0f51278 | 2013-12-15 18:40:23 -0800 | [diff] [blame] | 69 | #endif // Y4MINPUT_H_ |