--- encoder.h 2002/03/08 02:44:31 1.1.1.1 +++ encoder.h 2010/12/18 16:02:00 1.34 @@ -1,147 +1,270 @@ -/************************************************************************** +/***************************************************************************** * - * Modifications: + * XVID MPEG-4 VIDEO CODEC + * - Encoder related header - * - * 22.08.2001 added support for EXT_MODE encoding mode - * support for EXTENDED API - * 22.08.2001 fixed bug in iDQtab + * Copyright(C) 2002-2010 Michael Militzer + * 2002-2003 Peter Ross * - * Michael Militzer + * This program is free software ; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation ; either version 2 of the License, or + * (at your option) any later version. * - **************************************************************************/ + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY ; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program ; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: encoder.h,v 1.34 2010/12/18 16:02:00 Isibaar Exp $ + * + ****************************************************************************/ #ifndef _ENCODER_H_ #define _ENCODER_H_ - #include "xvid.h" - #include "portab.h" #include "global.h" -#include "image/image.h" - - -#define H263_QUANT 0 -#define MPEG4_QUANT 1 - - -typedef uint32_t bool; - - -typedef enum -{ - I_VOP = 0, - P_VOP = 1 -} -VOP_TYPE; -/*********************************** - - Encoding Parameters - -************************************/ +/***************************************************************************** + * Constants + ****************************************************************************/ + +/* lambda base exponential. 1<= 0 */ + + /* multithreaded stuff */ + int num_threads; /* number of encoder threads */ + SMPData * smpData; /* data structures used to pass all thread-specific data */ + + int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */ + + float fMvPrevSigma; + + int num_slices; /* number of slices to code */ +} Encoder; + +/***************************************************************************** + * Inline functions + ****************************************************************************/ + +static __inline uint8_t +get_fcode(uint16_t sr) { - if (sr <= 16) + if (sr <= 16) return 1; - else if (sr <= 32) + else if (sr <= 32) return 2; - else if (sr <= 64) + else if (sr <= 64) return 3; - else if (sr <= 128) + else if (sr <= 128) return 4; - else if (sr <= 256) + else if (sr <= 256) return 5; - else if (sr <= 512) + else if (sr <= 512) return 6; - else if (sr <= 1024) + else if (sr <= 1024) return 7; - else + else return 0; } -#endif /* _ENCODER_H_ */ +/***************************************************************************** + * Prototypes + ****************************************************************************/ + +void init_encoder(uint32_t cpu_flags); + +int enc_create(xvid_enc_create_t * create); +int enc_destroy(Encoder * pEnc); +int enc_encode(Encoder * pEnc, + xvid_enc_frame_t * pFrame, + xvid_enc_stats_t * stats); + +#endif