⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skl_mpg4.h

📁 从FFMPEG转换而来的H264解码程序,VC下编译..
💻 H
📖 第 1 页 / 共 3 页
字号:
    virtual SKL_MEM_I *Set_Memory_Manager(SKL_MEM_I *Mem=0) = 0;

      /** Sets the CPU feature to use.
          @param Cpu : see the enum description for a list of available
          cpu features. */
    virtual void Set_CPU(SKL_CPU_FEATURE Cpu = SKL_CPU_DETECT) = 0;

       /** Set post-decoding hook function.
           @ see SKL_MP4_SLICER
           @param Slicer callback function to use
           @param Slicer_Data can be anything, and will be passed as is
           to the Slicer hook function. */
    virtual void Set_Slicer(SKL_MP4_SLICER Slicer, SKL_ANY Slicer_Data=0) = 0;

      /** @internal Sets the internal debug level. */
    virtual void Set_Debug_Level(int Level=0) = 0;

      /** @internal
          For debug only. Returns all the Y/U/V planes in a single, edged, frame
          @param Pic the structure filled with frame's pixels  */
    virtual void Get_All_Frames(SKL_MP4_PIC *Pic) const = 0;

     /** @internal unused for now. */
    virtual int Ioctl(SKL_CST_STRING Param) = 0;
};

//////////////////////////////////////////////////////////
//  SKL_MP4_ENC : encoder class
//////////////////////////////////////////////////////////

 /** @class SKL_MP4_ENC

    SKL_MP4_ENC is the main encoding class. It is responsible for
    the bitstream coding only (that is: enforcing the syntax).
    The motion estimation is performed by an external module
    (SKL_MP4_ANALYZER), and parameter exchange is done using
    Get_Param().

    All methods are virtual, just like the COM-object
    paradigm. It eases the dynamic class loading
    (just map the proxy's symbol from dll, the vtbl
    will come along).

    @see SKL_MP4_ANALYZER.
  */

struct SKL_MP4_ENC
{
  protected:

    SKL_MP4_ENC(); /**< protected constructor. Use Skl_MP4_New_Encoder() */
    virtual ~SKL_MP4_ENC();  /**< protected destructor. use Skl_MP4_Delete_Encoder() */
    friend SKL_MP4_ENC *Skl_MP4_New_Encoder();
    friend void Skl_MP4_Delete_Encoder(SKL_MP4_ENC*);

  public:
      /** Set the dimensions of the next input frame. A SKL_MP4_PIC structure
          is returned, ready for holding fresh data.<p>
          <b>Warning</b> : beware of the SKL_MP4_PIC data layout!
          @param Width the width, in pixel, of the input picture.
          @param Height the height, in pixel, of the input picture.
          @return This functions returns a uninitialized picture structure
          SKL_MP4_PIC, ready to be filled with incoming YUV data.
          @see SKL_MP4_PIC
        */
    virtual const SKL_MP4_PIC *Prepare_Next_Frame(int Width, int Height) = 0;

      /** Return the last input frame set up by previous call to Prepare_Next_Frame().
          This data is only valid until next call to Encode()
          <b>Warning</b> : beware of the SKL_MP4_PIC data layout!
          @return Last available input frame.
          @see SKL_MP4_PIC
        */
    virtual const SKL_MP4_PIC *Get_Next_Frame() const = 0;

      /** Return the last coded frame, if any.
          This data is only valid until next call to Encode()
          <b>Warning</b> : beware of the SKL_MP4_PIC data layout!
          @return Last coded frame.
          @see SKL_MP4_PIC
        */
    virtual const SKL_MP4_PIC *Get_Last_Coded_Frame() const = 0;

      /** Encode next input frame, as set up by call to Prepare_Next_Frame.
          @return the number of coded bytes available for writting in the buffer is returned.
          @see Get_Bits, Get_Bits_Length, Prepare_Next_Frame. */
    virtual int Encode() = 0;

      /** Mark the end of sequence in the bitstream. Returns number of coded bytes.
          @see Get_Bits, Get_Bits_Length. */
    virtual int Finish_Encoding() = 0;

      /** Returns the pointer to the coded bytes after last call to Encode().
          This pointer and its content is only valid until next call to Encode().
          The number of bytes is available using the Get_Bits_Length() member function.
          @see Encode, Get_Bits_Length */
    virtual const SKL_BYTE *Get_Bits() const = 0;

      /** Returns the number of coded bytes after last call to Encode().
          This value is only valid until next call to Encode().
          The pointer to these bytes is available using the Get_Bits() member function.
          @see Encode, Get_Bits */
    virtual int Get_Bits_Length() const = 0;

      /** Set a new memory pool to use internally for subsequent memory allocation.
          Warning: it should preferably be called at start-up only,
          to ensure that cycles of New()/Delete() are performed on the
          same memory pool.
          @param Mem The memory pool to use. If equal to 0 (default),
          the C++ heap will be used.
          @return This function will return the previous memory manager.
          @see SKL_MEM_I */
    virtual SKL_MEM_I *Set_Memory_Manager(SKL_MEM_I *Mem=0) = 0;

      /** Sets the CPU feature to use.
          @param Cpu : see the enum description for a list of available
          cpu features. */
    virtual void Set_CPU(SKL_CPU_FEATURE Cpu = SKL_CPU_DETECT) = 0;

      /** Sets the custom quantization matrix for MPEG4 quantization type (0).
          @param Intra Should be 1 to use the custom matrix for intra macroblocks, or 0
          for inter macroblocks.
          @param M a pointer to 64 bytes containing the 8x8 matrix coefficients. If
          the pointer is null, the coefficients are restored to their default, initial,
          values. */
    virtual void Set_Custom_Matrix(int Intra, const SKL_BYTE *M=0) = 0;

      /** This function plugs a new analyzer code in replacement of
          the previous one.
          @return Set_Analyzer() returns previous analyzer.
          @param Analyzer Should be 0 to restore the default, built-in, analyzer.
          @see Get_analyzer
          @see SKL_MP4_ANALYZER */
    virtual SKL_MP4_ANALYZER *Set_Analyzer(SKL_MP4_ANALYZER *Analyzer=0) = 0;

      /** Returns the analyzer currently associated with the encoder.
          @see Set_analyzer */
    virtual SKL_MP4_ANALYZER *Get_Analyzer() const = 0;

       /** Set post-coding hook function. The signature of this function
           is the following typedef: <p>
           typedef void (*SKL_MP4_SLICER)(const SKL_MP4_PIC *Pic, int y, int Height, SKL_ANY Data);
           @param Slicer callback function to use
           @param Slicer_Data can be anything, and will be passed as is
           to the Slicer hook function. */
    virtual void Set_Slicer(SKL_MP4_SLICER Slicer, SKL_ANY Slicer_Data=0) = 0;

      /** @internal
          For debug only. Returns all the Y/U/V planes in a single, edged, frame
          @param Pic the structure filled with frame's pixels  */
    virtual void Get_All_Frames(SKL_MP4_PIC *Pic) const = 0;

      /** @internal Sets the internal debug level. */
    virtual void Set_Debug_Level(int Level=0) = 0;

     /** This method can be used for very special syntax controls over the bitstream.
        @param Param can be one of the following constant strings:<br>
        <ul>
        <li>"emit-key-headers": for streaming purpose, the bitstream will contain
        a VOL header every time a keyframe is transmitted.<br></li>
        <li>"no-emit-key-headers": disables the above (default).<br></li>
        <li>"emit-sequence-codes": the bitstream will contain a SEQUENCE_START and
        SEQUENCE_END codes at the beginning and the end.<br></li>
        <li>"no-sequence-codes": disables the above (default).<br></li>
        </ul>
        Note: Call to this method should occur preferably at the beginning of
        the encoding process.
       */
    virtual int Ioctl(SKL_CST_STRING Param) = 0;
};


//////////////////////////////////////////////////////////
//  SKL_MP4_ANALYZER
// Frame analyzers to be plugged into SKL_MP4_ENC
//////////////////////////////////////////////////////////

  /** @struct SKL_MP4_INFOS
      SKL_MP4_INFOS is used to share informations between
      the bitstream-coding core (instance of SKL_MP4_ENC)
      and the frame analyzer (instance of SKL_MP4_ANALYZER)
    */
struct SKL_MP4_INFOS
{
  SKL_MP4_INFOS(SKL_MEM_I *Memory=0);

  SKL_MEM_I *Mem;                                   /**< Memory pool */
  SKL_MEM_I *Set_Memory_Manager(SKL_MEM_I *mem);    /**< mem=0 => use C++ heap */

    /** public infos of general interest */

  int Width;             /**< Width of picture, in pixel. */
  int Height;            /**< Height of picture, in pixel. */
  int BpS;               /**< Bytes Per Scanline */
  int Frame_Number;      /**< Frame number in display order. */

  int MB_W;              /**< Width of padded picture, in macroblock units */
  int MB_H;              /**< Height of padded picture, in macroblock units */
  int MV_Stride;         /**< stride for motion vectors array */

  int Texture_Bits;
  int MV_Bits;
  int Coded_Bits;

  SKL_MP4_PIC *Past;     /**< The past picture use for reference */
  SKL_MP4_PIC *Cur;      /**< The current picture being motion-searched */
  SKL_MP4_PIC *Future;   /**< The future reference picture, if applicable (B-VOP). */

  const SKL_IMG_DSP *Img_Dsp;   /**< Image low-level DSP functions */
  const SKL_MB_DSP  *MB_Dsp;    /**< Macroblock low-level DSP functions */
  SKL_GMC_DSP       *GMC_Dsp;   /**< GMC low-level DSP functions */
};

  /** @class SKL_MP4_ANALYZER
      Base class for analyzing input, making coding decisions
      and performing bit-rate control. Actually drives
      the bitstream-coder (SKL_MP4_ENC).
      Setting/Access/Control of internal parameter is granted
      through the Set_Param() and Get_Param() functions.
      See description of this function for details. We encourage you
      to have a look at the example 'tmp4.cpp', that exercises every
      possible params of Set_Param() through the command-line options.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -