Home | History | Annotate | Download | only in inc
      1 /*--------------------------------------------------------------------------
      2 Copyright (c) 2013, 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 "Map.h"
     51 #include "qtypes.h"
     52 #include "OMX_Core.h"
     53 #include "OMX_QCOMExtns.h"
     54 
     55 
     56 class HEVC_Utils
     57 {
     58 public:
     59     HEVC_Utils();
     60     ~HEVC_Utils();
     61 
     62 	enum {
     63 		NAL_UNIT_CODED_SLICE_TRAIL_N,	// 0
     64 		NAL_UNIT_CODED_SLICE_TRAIL_R,	// 1
     65 		NAL_UNIT_CODED_SLICE_TSA_N,		// 2
     66 		NAL_UNIT_CODED_SLICE_TLA,		// 3
     67 		NAL_UNIT_CODED_SLICE_STSA_N,    // 4
     68 		NAL_UNIT_CODED_SLICE_STSA_R,	// 5
     69 		NAL_UNIT_CODED_SLICE_RADL_N,	// 6
     70 		NAL_UNIT_CODED_SLICE_DLP,		// 7
     71 		NAL_UNIT_CODED_SLICE_RASL_N,	// 8
     72 		NAL_UNIT_CODED_SLICE_TFD,		// 9
     73 		NAL_UNIT_RESERVED_10,
     74 		NAL_UNIT_RESERVED_11,
     75 		NAL_UNIT_RESERVED_12,
     76 		NAL_UNIT_RESERVED_13,
     77 		NAL_UNIT_RESERVED_14,
     78 		NAL_UNIT_RESERVED_15,
     79 		NAL_UNIT_CODED_SLICE_BLA,		// 16
     80 		NAL_UNIT_CODED_SLICE_BLANT,		// 17
     81 		NAL_UNIT_CODED_SLICE_BLA_N_LP,	// 18
     82 		NAL_UNIT_CODED_SLICE_IDR,		// 19
     83 		NAL_UNIT_CODED_SLICE_IDR_N_LP,	// 20
     84 		NAL_UNIT_CODED_SLICE_CRA,		// 21
     85 		NAL_UNIT_RESERVED_22,
     86 		NAL_UNIT_RESERVED_23,
     87 		NAL_UNIT_RESERVED_24,
     88 		NAL_UNIT_RESERVED_25,
     89 		NAL_UNIT_RESERVED_26,
     90 		NAL_UNIT_RESERVED_27,
     91 
     92 		NAL_UNIT_RESERVED_28,
     93 		NAL_UNIT_RESERVED_29,
     94 		NAL_UNIT_RESERVED_30,
     95 		NAL_UNIT_RESERVED_31,
     96 
     97 		NAL_UNIT_VPS,					// 32
     98 		NAL_UNIT_SPS,					// 33
     99 		NAL_UNIT_PPS,					// 34
    100 		NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35
    101 		NAL_UNIT_EOS,					// 36
    102 		NAL_UNIT_EOB,					// 37
    103 		NAL_UNIT_FILLER_DATA,			// 38
    104 		NAL_UNIT_SEI,					// 39 Prefix SEI
    105 		NAL_UNIT_SEI_SUFFIX,			// 40 Suffix SEI
    106 
    107 		NAL_UNIT_RESERVED_41,
    108 		NAL_UNIT_RESERVED_42,
    109 		NAL_UNIT_RESERVED_43,
    110 		NAL_UNIT_RESERVED_44,
    111 		NAL_UNIT_RESERVED_45,
    112 		NAL_UNIT_RESERVED_46,
    113 		NAL_UNIT_RESERVED_47,
    114 		NAL_UNIT_UNSPECIFIED_48,
    115 		NAL_UNIT_UNSPECIFIED_49,
    116 		NAL_UNIT_UNSPECIFIED_50,
    117 		NAL_UNIT_UNSPECIFIED_51,
    118 		NAL_UNIT_UNSPECIFIED_52,
    119 		NAL_UNIT_UNSPECIFIED_53,
    120 		NAL_UNIT_UNSPECIFIED_54,
    121 		NAL_UNIT_UNSPECIFIED_55,
    122 		NAL_UNIT_UNSPECIFIED_56,
    123 		NAL_UNIT_UNSPECIFIED_57,
    124 		NAL_UNIT_UNSPECIFIED_58,
    125 		NAL_UNIT_UNSPECIFIED_59,
    126 		NAL_UNIT_UNSPECIFIED_60,
    127 		NAL_UNIT_UNSPECIFIED_61,
    128 		NAL_UNIT_UNSPECIFIED_62,
    129 		NAL_UNIT_UNSPECIFIED_63,
    130 		NAL_UNIT_INVALID,
    131 	};
    132 
    133 
    134     void initialize_frame_checking_environment();
    135     bool isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr,
    136                     OMX_IN OMX_U32 size_of_nal_length_field,
    137                     OMX_OUT OMX_BOOL &isNewFrame);
    138 
    139 private:
    140 
    141     bool              m_forceToStichNextNAL;
    142     bool              m_au_data;
    143     uint32 nalu_type;
    144 };
    145 
    146 #endif /* HEVC_UTILS_H */
    147