1*77c1e3ccSAndroid Build Coastguard Worker /* 2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker * 4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker */ 11*77c1e3ccSAndroid Build Coastguard Worker 12*77c1e3ccSAndroid Build Coastguard Worker /*!\defgroup aom AOM 13*77c1e3ccSAndroid Build Coastguard Worker * \ingroup codecs 14*77c1e3ccSAndroid Build Coastguard Worker * AOM is aom's newest video compression algorithm that uses motion 15*77c1e3ccSAndroid Build Coastguard Worker * compensated prediction, Discrete Cosine Transform (DCT) coding of the 16*77c1e3ccSAndroid Build Coastguard Worker * prediction error signal and context dependent entropy coding techniques 17*77c1e3ccSAndroid Build Coastguard Worker * based on arithmetic principles. It features: 18*77c1e3ccSAndroid Build Coastguard Worker * - YUV 4:2:0 image format 19*77c1e3ccSAndroid Build Coastguard Worker * - Macro-block based coding (16x16 luma plus two 8x8 chroma) 20*77c1e3ccSAndroid Build Coastguard Worker * - 1/4 (1/8) pixel accuracy motion compensated prediction 21*77c1e3ccSAndroid Build Coastguard Worker * - 4x4 DCT transform 22*77c1e3ccSAndroid Build Coastguard Worker * - 128 level linear quantizer 23*77c1e3ccSAndroid Build Coastguard Worker * - In loop deblocking filter 24*77c1e3ccSAndroid Build Coastguard Worker * - Context-based entropy coding 25*77c1e3ccSAndroid Build Coastguard Worker * 26*77c1e3ccSAndroid Build Coastguard Worker * @{ 27*77c1e3ccSAndroid Build Coastguard Worker */ 28*77c1e3ccSAndroid Build Coastguard Worker /*!\file 29*77c1e3ccSAndroid Build Coastguard Worker * \brief Provides controls common to both the AOM encoder and decoder. 30*77c1e3ccSAndroid Build Coastguard Worker */ 31*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AOM_AOM_H_ 32*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AOM_AOM_H_ 33*77c1e3ccSAndroid Build Coastguard Worker 34*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_codec.h" 35*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_image.h" 36*77c1e3ccSAndroid Build Coastguard Worker 37*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 38*77c1e3ccSAndroid Build Coastguard Worker extern "C" { 39*77c1e3ccSAndroid Build Coastguard Worker #endif 40*77c1e3ccSAndroid Build Coastguard Worker 41*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Control functions 42*77c1e3ccSAndroid Build Coastguard Worker * 43*77c1e3ccSAndroid Build Coastguard Worker * The set of macros define the control functions of AOM interface 44*77c1e3ccSAndroid Build Coastguard Worker * The range for common control IDs is 230-255(max). 45*77c1e3ccSAndroid Build Coastguard Worker */ 46*77c1e3ccSAndroid Build Coastguard Worker enum aom_com_control_id { 47*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Codec control function to get a pointer to a reference frame 48*77c1e3ccSAndroid Build Coastguard Worker * 49*77c1e3ccSAndroid Build Coastguard Worker * av1_ref_frame_t* parameter 50*77c1e3ccSAndroid Build Coastguard Worker */ 51*77c1e3ccSAndroid Build Coastguard Worker AV1_GET_REFERENCE = 230, 52*77c1e3ccSAndroid Build Coastguard Worker 53*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Codec control function to write a frame into a reference buffer 54*77c1e3ccSAndroid Build Coastguard Worker * 55*77c1e3ccSAndroid Build Coastguard Worker * av1_ref_frame_t* parameter 56*77c1e3ccSAndroid Build Coastguard Worker */ 57*77c1e3ccSAndroid Build Coastguard Worker AV1_SET_REFERENCE = 231, 58*77c1e3ccSAndroid Build Coastguard Worker 59*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Codec control function to get a copy of reference frame from the 60*77c1e3ccSAndroid Build Coastguard Worker * decoder 61*77c1e3ccSAndroid Build Coastguard Worker * 62*77c1e3ccSAndroid Build Coastguard Worker * av1_ref_frame_t* parameter 63*77c1e3ccSAndroid Build Coastguard Worker */ 64*77c1e3ccSAndroid Build Coastguard Worker AV1_COPY_REFERENCE = 232, 65*77c1e3ccSAndroid Build Coastguard Worker 66*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Codec control function to get a pointer to the new frame 67*77c1e3ccSAndroid Build Coastguard Worker * 68*77c1e3ccSAndroid Build Coastguard Worker * aom_image_t* parameter 69*77c1e3ccSAndroid Build Coastguard Worker */ 70*77c1e3ccSAndroid Build Coastguard Worker AV1_GET_NEW_FRAME_IMAGE = 233, 71*77c1e3ccSAndroid Build Coastguard Worker 72*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Codec control function to copy the new frame to an external buffer 73*77c1e3ccSAndroid Build Coastguard Worker * 74*77c1e3ccSAndroid Build Coastguard Worker * aom_image_t* parameter 75*77c1e3ccSAndroid Build Coastguard Worker */ 76*77c1e3ccSAndroid Build Coastguard Worker AV1_COPY_NEW_FRAME_IMAGE = 234, 77*77c1e3ccSAndroid Build Coastguard Worker 78*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Start point of control IDs for aom_dec_control_id. 79*77c1e3ccSAndroid Build Coastguard Worker * Any new common control IDs should be added above. 80*77c1e3ccSAndroid Build Coastguard Worker */ 81*77c1e3ccSAndroid Build Coastguard Worker AOM_DECODER_CTRL_ID_START = 256 82*77c1e3ccSAndroid Build Coastguard Worker // No common control IDs should be added after AOM_DECODER_CTRL_ID_START. 83*77c1e3ccSAndroid Build Coastguard Worker }; 84*77c1e3ccSAndroid Build Coastguard Worker 85*77c1e3ccSAndroid Build Coastguard Worker /*!\brief AV1 specific reference frame data struct 86*77c1e3ccSAndroid Build Coastguard Worker * 87*77c1e3ccSAndroid Build Coastguard Worker * Define the data struct to access av1 reference frames. 88*77c1e3ccSAndroid Build Coastguard Worker */ 89*77c1e3ccSAndroid Build Coastguard Worker typedef struct av1_ref_frame { 90*77c1e3ccSAndroid Build Coastguard Worker int idx; /**< frame index to get (input) */ 91*77c1e3ccSAndroid Build Coastguard Worker int use_external_ref; /**< Directly use external ref buffer(decoder only) */ 92*77c1e3ccSAndroid Build Coastguard Worker aom_image_t img; /**< img structure to populate (output) */ 93*77c1e3ccSAndroid Build Coastguard Worker } av1_ref_frame_t; 94*77c1e3ccSAndroid Build Coastguard Worker 95*77c1e3ccSAndroid Build Coastguard Worker /*!\cond */ 96*77c1e3ccSAndroid Build Coastguard Worker /*!\brief aom decoder control function parameter type 97*77c1e3ccSAndroid Build Coastguard Worker * 98*77c1e3ccSAndroid Build Coastguard Worker * Defines the data type for each of AOM decoder control function requires. 99*77c1e3ccSAndroid Build Coastguard Worker * 100*77c1e3ccSAndroid Build Coastguard Worker * \note For each control ID "X", a macro-define of 101*77c1e3ccSAndroid Build Coastguard Worker * AOM_CTRL_X is provided. It is used at compile time to determine 102*77c1e3ccSAndroid Build Coastguard Worker * if the control ID is supported by the libaom library available, 103*77c1e3ccSAndroid Build Coastguard Worker * when the libaom version cannot be controlled. 104*77c1e3ccSAndroid Build Coastguard Worker */ 105*77c1e3ccSAndroid Build Coastguard Worker AOM_CTRL_USE_TYPE(AV1_GET_REFERENCE, av1_ref_frame_t *) 106*77c1e3ccSAndroid Build Coastguard Worker #define AOM_CTRL_AV1_GET_REFERENCE 107*77c1e3ccSAndroid Build Coastguard Worker 108*77c1e3ccSAndroid Build Coastguard Worker AOM_CTRL_USE_TYPE(AV1_SET_REFERENCE, av1_ref_frame_t *) 109*77c1e3ccSAndroid Build Coastguard Worker #define AOM_CTRL_AV1_SET_REFERENCE 110*77c1e3ccSAndroid Build Coastguard Worker 111*77c1e3ccSAndroid Build Coastguard Worker AOM_CTRL_USE_TYPE(AV1_COPY_REFERENCE, av1_ref_frame_t *) 112*77c1e3ccSAndroid Build Coastguard Worker #define AOM_CTRL_AV1_COPY_REFERENCE 113*77c1e3ccSAndroid Build Coastguard Worker 114*77c1e3ccSAndroid Build Coastguard Worker AOM_CTRL_USE_TYPE(AV1_GET_NEW_FRAME_IMAGE, aom_image_t *) 115*77c1e3ccSAndroid Build Coastguard Worker #define AOM_CTRL_AV1_GET_NEW_FRAME_IMAGE 116*77c1e3ccSAndroid Build Coastguard Worker 117*77c1e3ccSAndroid Build Coastguard Worker AOM_CTRL_USE_TYPE(AV1_COPY_NEW_FRAME_IMAGE, aom_image_t *) 118*77c1e3ccSAndroid Build Coastguard Worker #define AOM_CTRL_AV1_COPY_NEW_FRAME_IMAGE 119*77c1e3ccSAndroid Build Coastguard Worker 120*77c1e3ccSAndroid Build Coastguard Worker /*!\endcond */ 121*77c1e3ccSAndroid Build Coastguard Worker /*! @} - end defgroup aom */ 122*77c1e3ccSAndroid Build Coastguard Worker 123*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 124*77c1e3ccSAndroid Build Coastguard Worker } // extern "C" 125*77c1e3ccSAndroid Build Coastguard Worker #endif 126*77c1e3ccSAndroid Build Coastguard Worker 127*77c1e3ccSAndroid Build Coastguard Worker #endif // AOM_AOM_AOM_H_ 128