1 /*-------------------------------------------------------------------------- 2 Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved. 3 4 Redistribution and use in source and binary forms, with or without 5 modification, are permitted provided that the following conditions are met: 6 * Redistributions of source code must retain the above copyright 7 notice, this list of conditions and the following disclaimer. 8 * Redistributions in binary form must reproduce the above copyright 9 notice, this list of conditions and the following disclaimer in the 10 documentation and/or other materials provided with the distribution. 11 * Neither the name of The Linux Foundation nor 12 the names of its contributors may be used to endorse or promote 13 products derived from this software without specific prior written 14 permission. 15 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 --------------------------------------------------------------------------*/ 28 29 30 #ifndef HEVC_UTILS_H 31 #define HEVC_UTILS_H 32 33 /*======================================================================== 34 35 O p e n M M 36 U t i l i t i e s a n d H e l p e r R o u t i n e s 37 38 *//** @file HEVC_Utils.h 39 This module contains H264 video decoder utilities and helper routines. 40 41 *//*====================================================================== */ 42 43 /* ======================================================================= 44 45 INCLUDE FILES FOR MODULE 46 47 ========================================================================== */ 48 #include <stdio.h> 49 #include <utils/Log.h> 50 #include "qtypes.h" 51 #include "OMX_Core.h" 52 #include "OMX_QCOMExtns.h" 53 54 55 class HEVC_Utils 56 { 57 public: 58 HEVC_Utils(); 59 ~HEVC_Utils(); 60 61 enum { 62 NAL_UNIT_CODED_SLICE_TRAIL_N, // 0 63 NAL_UNIT_CODED_SLICE_TRAIL_R, // 1 64 NAL_UNIT_CODED_SLICE_TSA_N, // 2 65 NAL_UNIT_CODED_SLICE_TLA, // 3 66 NAL_UNIT_CODED_SLICE_STSA_N, // 4 67 NAL_UNIT_CODED_SLICE_STSA_R, // 5 68 NAL_UNIT_CODED_SLICE_RADL_N, // 6 69 NAL_UNIT_CODED_SLICE_DLP, // 7 70 NAL_UNIT_CODED_SLICE_RASL_N, // 8 71 NAL_UNIT_CODED_SLICE_TFD, // 9 72 NAL_UNIT_RESERVED_10, 73 NAL_UNIT_RESERVED_11, 74 NAL_UNIT_RESERVED_12, 75 NAL_UNIT_RESERVED_13, 76 NAL_UNIT_RESERVED_14, 77 NAL_UNIT_RESERVED_15, 78 NAL_UNIT_CODED_SLICE_BLA, // 16 79 NAL_UNIT_CODED_SLICE_BLANT, // 17 80 NAL_UNIT_CODED_SLICE_BLA_N_LP, // 18 81 NAL_UNIT_CODED_SLICE_IDR, // 19 82 NAL_UNIT_CODED_SLICE_IDR_N_LP, // 20 83 NAL_UNIT_CODED_SLICE_CRA, // 21 84 NAL_UNIT_RESERVED_22, 85 NAL_UNIT_RESERVED_23, 86 NAL_UNIT_RESERVED_24, 87 NAL_UNIT_RESERVED_25, 88 NAL_UNIT_RESERVED_26, 89 NAL_UNIT_RESERVED_27, 90 91 NAL_UNIT_RESERVED_28, 92 NAL_UNIT_RESERVED_29, 93 NAL_UNIT_RESERVED_30, 94 NAL_UNIT_RESERVED_31, 95 96 NAL_UNIT_VPS, // 32 97 NAL_UNIT_SPS, // 33 98 NAL_UNIT_PPS, // 34 99 NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35 100 NAL_UNIT_EOS, // 36 101 NAL_UNIT_EOB, // 37 102 NAL_UNIT_FILLER_DATA, // 38 103 NAL_UNIT_SEI, // 39 Prefix SEI 104 NAL_UNIT_SEI_SUFFIX, // 40 Suffix SEI 105 106 NAL_UNIT_RESERVED_41, 107 NAL_UNIT_RESERVED_42, 108 NAL_UNIT_RESERVED_43, 109 NAL_UNIT_RESERVED_44, 110 NAL_UNIT_RESERVED_45, 111 NAL_UNIT_RESERVED_46, 112 NAL_UNIT_RESERVED_47, 113 NAL_UNIT_UNSPECIFIED_48, 114 NAL_UNIT_UNSPECIFIED_49, 115 NAL_UNIT_UNSPECIFIED_50, 116 NAL_UNIT_UNSPECIFIED_51, 117 NAL_UNIT_UNSPECIFIED_52, 118 NAL_UNIT_UNSPECIFIED_53, 119 NAL_UNIT_UNSPECIFIED_54, 120 NAL_UNIT_UNSPECIFIED_55, 121 NAL_UNIT_UNSPECIFIED_56, 122 NAL_UNIT_UNSPECIFIED_57, 123 NAL_UNIT_UNSPECIFIED_58, 124 NAL_UNIT_UNSPECIFIED_59, 125 NAL_UNIT_UNSPECIFIED_60, 126 NAL_UNIT_UNSPECIFIED_61, 127 NAL_UNIT_UNSPECIFIED_62, 128 NAL_UNIT_UNSPECIFIED_63, 129 NAL_UNIT_INVALID, 130 }; 131 132 133 void initialize_frame_checking_environment(); 134 bool isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr, 135 OMX_IN OMX_U32 size_of_nal_length_field, 136 OMX_OUT OMX_BOOL &isNewFrame); 137 138 private: 139 140 bool m_forceToStichNextNAL; 141 bool m_au_data; 142 uint32 nalu_type; 143 }; 144 145 #endif /* HEVC_UTILS_H */ 146