[xiph-cvs] cvs commit: theora/lib encode.c encoder_internal.h misc_common.c toplevel.c
Monty
xiphmont at xiph.org
Tue Sep 17 00:01:34 PDT 2002
xiphmont 02/09/17 03:01:34
Modified: lib encode.c encoder_internal.h misc_common.c
toplevel.c
Log:
Incremental to avoid losing work
Revision Changes Path
1.2 +3 -3 theora/lib/encode.c
Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- encode.c 16 Sep 2002 07:10:02 -0000 1.1
+++ encode.c 17 Sep 2002 07:01:33 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encode.c,v 1.1 2002/09/16 07:10:02 xiphmont Exp $
+ last mod: $Id: encode.c,v 1.2 2002/09/17 07:01:33 xiphmont Exp $
********************************************************************/
@@ -240,7 +240,7 @@
}
/* Note the number of bits used to code the tree itself. */
- cpi->FrameBitCount = cpi->ThisFrameSize << 3;
+ cpi->FrameBitCount = oggpackB_bytes(&cpi->opb) << 3;
/* Mode and MV data not needed for key frames. */
if ( GetFrameType(&cpi->pb) != BASE_FRAME ){
@@ -250,7 +250,7 @@
PackMotionVectors (cpi);
}
- cpi->FrameBitCount = cpi->ThisFrameSize << 3;
+ cpi->FrameBitCount = oggpackB_bytes(&cpi->opb) << 3;
/* Optimise the DC tokens */
for ( i = 0; i < cpi->pb.CodedBlockIndex; i++ ) {
<p><p>1.2 +317 -164 theora/lib/encoder_internal.h
Index: encoder_internal.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_internal.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- encoder_internal.h 16 Sep 2002 07:10:02 -0000 1.1
+++ encoder_internal.h 17 Sep 2002 07:01:33 -0000 1.2
@@ -11,223 +11,376 @@
********************************************************************
function:
- last mod: $Id: encoder_internal.h,v 1.1 2002/09/16 07:10:02 xiphmont Exp $
+ last mod: $Id: encoder_internal.h,v 1.2 2002/09/17 07:01:33 xiphmont Exp $
********************************************************************/
#include <ogg/ogg.h>
typedef struct CONFIG_TYPE2{
- UINT32 TargetBandwidth;
- UINT32 OutputFrameRate;
-
- UINT32 FirstFrameQ;
- UINT32 BaseQ;
- UINT32 MaxQ; /* Absolute Max Q allowed. */
- UINT32 ActiveMaxQ; /* Currently active Max Q */
+ ogg_uint32_t TargetBandwidth;
+ double OutputFrameRate;
+ ogg_uint32_t OutputFrameRateN;
+ ogg_uint32_t OutputFrameRateD;
+
+ ogg_uint32_t FirstFrameQ;
+ ogg_uint32_t BaseQ;
+ ogg_uint32_t MaxQ; /* Absolute Max Q allowed. */
+ ogg_uint32_t ActiveMaxQ; /* Currently active Max Q */
} CONFIG_TYPE2;
+typedef struct{
+ unsigned char * Yuv0ptr;
+ unsigned char * Yuv1ptr;
+ unsigned char * SrfWorkSpcPtr;
+ unsigned char * disp_fragments;
+
+ ogg_uint32_t * RegionIndex; /* Gives pixel index for top left of
+ each block */
+ ogg_uint32_t VideoFrameHeight;
+ ogg_uint32_t VideoFrameWidth;
+ unsigned char HFragPixels;
+ unsigned char VFragPixels;
+
+} SCAN_CONFIG_DATA;
+
+typedef unsigned char YUV_BUFFER_ENTRY;
+
+typedef struct{
+ ogg_int32_t x;
+ ogg_int32_t y;
+} MOTION_VECTOR;
+
+typedef ogg_int16_t Q_LIST_ENTRY;
+typedef Q_LIST_ENTRY Q_LIST[64];
+
+typedef struct PP_INSTANCE {
+ ogg_uint32_t PrevFrameLimit;
+ ogg_uint32_t *ScanPixelIndexTableAlloc;
+ signed char *ScanDisplayFragmentsAlloc;
+
+ signed char *PrevFragmentsAlloc[MAX_PREV_FRAMES];
+
+ ogg_uint32_t *FragScoresAlloc; /* The individual frame difference ratings. */
+ signed char *SameGreyDirPixelsAlloc;
+ signed char *BarBlockMapAlloc;
+
+ /* Number of pixels changed by diff threshold in row of a fragment. */
+ unsigned char *FragDiffPixelsAlloc;
+
+ unsigned char *PixelScoresAlloc;
+ unsigned char *PixelChangedMapAlloc;
+ unsigned char *ChLocalsAlloc;
+ ogg_int16_t *yuv_differencesAlloc;
+ ogg_int32_t *RowChangedPixelsAlloc;
+ signed char *TmpCodedMapAlloc;
+
+ ogg_uint32_t *ScanPixelIndexTable;
+ signed char *ScanDisplayFragments;
+
+ signed char *PrevFragments[MAX_PREV_FRAMES];
+
+ ogg_uint32_t *FragScores; /* The individual frame difference ratings. */
+ signed char *SameGreyDirPixels;
+ signed char *BarBlockMap;
+
+ /* Number of pixels changed by diff threshold in row of a fragment. */
+ unsigned char *FragDiffPixels;
+
+ unsigned char *PixelScores;
+ unsigned char *PixelChangedMap;
+ unsigned char *ChLocals;
+ ogg_int16_t *yuv_differences;
+ ogg_int32_t *RowChangedPixels;
+ signed char *TmpCodedMap;
+
+ /* Plane pointers and dimension variables */
+ unsigned char * YPlanePtr0;
+ unsigned char * YPlanePtr1;
+ unsigned char * UPlanePtr0;
+ unsigned char * UPlanePtr1;
+ unsigned char * VPlanePtr0;
+ unsigned char * VPlanePtr1;
+
+ ogg_uint32_t VideoYPlaneWidth;
+ ogg_uint32_t VideoYPlaneHeight;
+ ogg_uint32_t VideoUVPlaneWidth;
+ ogg_uint32_t VideoUVPlaneHeight;
+
+ ogg_uint32_t VideoYPlaneStride;
+ ogg_uint32_t VideoUPlaneStride;
+ ogg_uint32_t VideoVPlaneStride;
+
+ /* Scan control variables. */
+ unsigned char HFragPixels;
+ unsigned char VFragPixels;
+
+ ogg_uint32_t ScanFrameFragments;
+ ogg_uint32_t ScanYPlaneFragments;
+ ogg_uint32_t ScanUVPlaneFragments;
+ ogg_uint32_t ScanHFragments;
+ ogg_uint32_t ScanVFragments;
+
+ ogg_uint32_t YFramePixels;
+ ogg_uint32_t UVFramePixels;
+
+ ogg_uint32_t SgcThresh;
+
+ ogg_uint32_t OutputBlocksUpdated;
+ ogg_uint32_t KFIndicator;
+
+ /* The pre-processor scan configuration. */
+ SCAN_CONFIG_DATA ScanConfig;
+
+ ogg_int32_t SRFGreyThresh;
+ ogg_int32_t SRFColThresh;
+ ogg_int32_t SgcLevelThresh;
+ ogg_int32_t SuvcLevelThresh;
+
+ ogg_uint32_t NoiseSupLevel;
+
+ /* Block Thresholds. */
+ ogg_uint32_t PrimaryBlockThreshold;
+
+ int PAKEnabled;
+
+ int LevelThresh;
+ int NegLevelThresh;
+ int SrfThresh;
+ int NegSrfThresh;
+ int HighChange;
+ int NegHighChange;
+
+ /* Threshold lookup tables */
+ unsigned char SrfPakThreshTable[512];
+ unsigned char * SrfPakThreshTablePtr;
+ unsigned char SrfThreshTable[512];
+ unsigned char * SrfThreshTablePtr;
+ unsigned char SgcThreshTable[512];
+ unsigned char * SgcThreshTablePtr;
+
+ /* Variables controlling S.A.D. break outs. */
+ ogg_uint32_t GrpLowSadThresh;
+ ogg_uint32_t GrpHighSadThresh;
+ ogg_uint32_t ModifiedGrpLowSadThresh;
+ ogg_uint32_t ModifiedGrpHighSadThresh;
+
+ ogg_int32_t PlaneHFragments;
+ ogg_int32_t PlaneVFragments;
+ ogg_int32_t PlaneHeight;
+ ogg_int32_t PlaneWidth;
+ ogg_int32_t PlaneStride;
+
+ ogg_uint32_t BlockThreshold;
+ ogg_uint32_t BlockSgcThresh;
+ double UVBlockThreshCorrection;
+ double UVSgcCorrection;
+
+ double YUVPlaneCorrectionFactor;
+ double AbsDiff_ScoreMultiplierTable[256];
+ unsigned char NoiseScoreBoostTable[256];
+ unsigned char MaxLineSearchLen;
+
+ ogg_int32_t YuvDiffsCircularBufferSize;
+ ogg_int32_t ChLocalsCircularBufferSize;
+ ogg_int32_t PixelMapCircularBufferSize;
+
+} PP_INSTANCE;
+
typedef struct CP_INSTANCE {
/* Compressor Configuration */
SCAN_CONFIG_DATA ScanConfig;
- CONFIG_TYPE2 Configuration;
- BOOL QuickCompress;
- BOOL GoldenFrameEnabled;
- BOOL InterPrediction;
- BOOL MotionCompensation;
- BOOL AutoKeyFrameEnabled ;
- INT32 ForceKeyFrameEvery ;
- INT32 AutoKeyFrameThreshold ;
- UINT32 LastKeyFrame ;
- UINT32 MinimumDistanceToKeyFrame ;
- UINT32 KeyFrameDataTarget ; /* Data rate target for key frames */
- UINT32 KeyFrameFrequency ;
- BOOL DropFramesAllowed ;
- INT32 DropCount ;
- INT32 MaxConsDroppedFrames ;
- INT32 DropFrameTriggerBytes;
- BOOL DropFrameCandidate;
- UINT32 QualitySetting;
- UINT32 Sharpness;
- UINT32 PreProcFilterLevel;
- BOOL NoDrops;
+ CONFIG_TYPE2 Configuration;
+ int QuickCompress;
+ int GoldenFrameEnabled;
+ int InterPrediction;
+ int MotionCompensation;
+ int AutoKeyFrameEnabled ;
+ ogg_int32_t ForceKeyFrameEvery ;
+ ogg_int32_t AutoKeyFrameThreshold ;
+ ogg_uint32_t LastKeyFrame ;
+ ogg_uint32_t MinimumDistanceToKeyFrame ;
+ ogg_uint32_t KeyFrameDataTarget ; /* Data rate target for key frames */
+ ogg_uint32_t KeyFrameFrequency ;
+ int DropFramesAllowed ;
+ ogg_int32_t DropCount ;
+ ogg_int32_t MaxConsDroppedFrames ;
+ ogg_int32_t DropFrameTriggerBytes;
+ int DropFrameCandidate;
+ ogg_uint32_t QualitySetting;
+ ogg_uint32_t Sharpness;
+ ogg_uint32_t PreProcFilterLevel;
+ int NoDrops;
/* Compressor Statistics */
- double TotErrScore;
- INT64 KeyFrameCount; /* Count of key frames. */
- INT64 TotKeyFrameBytes;
- UINT32 LastKeyFrameSize;
- UINT32 PriorKeyFrameSize[KEY_FRAME_CONTEXT];
- UINT32 PriorKeyFrameDistance[KEY_FRAME_CONTEXT];
- INT32 FrameQuality[6];
- int DecoderErrorCode; /* Decoder error flag. */
- INT32 ThreshMapThreshold;
- INT32 TotalMotionScore;
- INT64 TotalByteCount;
- INT32 FixedQ;
+ double TotErrScore;
+ ogg_int64_t KeyFrameCount; /* Count of key frames. */
+ ogg_int64_t TotKeyFrameBytes;
+ ogg_uint32_t LastKeyFrameSize;
+ ogg_uint32_t PriorKeyFrameSize[KEY_FRAME_CONTEXT];
+ ogg_uint32_t PriorKeyFrameDistance[KEY_FRAME_CONTEXT];
+ ogg_int32_t FrameQuality[6];
+ int DecoderErrorCode; /* Decoder error flag. */
+ ogg_int32_t ThreshMapThreshold;
+ ogg_int32_t TotalMotionScore;
+ ogg_int64_t TotalByteCount;
+ ogg_int32_t FixedQ;
/* Frame Statistics */
- INT8 InterCodeCount;
- INT64 CurrentFrame;
- INT64 CarryOver ;
- UINT32 LastFrameSize;
- /*UINT32 ThisFrameSize; use the oggpackB primitive */
- /*UINT32 BufferedOutputBytes; */
- UINT32 FrameBitCount;
- BOOL ThisIsFirstFrame;
- BOOL ThisIsKeyFrame;
+ signed char InterCodeCount;
+ ogg_int64_t CurrentFrame;
+ ogg_int64_t CarryOver ;
+ ogg_uint32_t LastFrameSize;
+ ogg_uint32_t FrameBitCount;
+ int ThisIsFirstFrame;
+ int ThisIsKeyFrame;
- INT32 MotionScore;
- UINT32 RegulationBlocks;
- INT32 RecoveryMotionScore;
- BOOL RecoveryBlocksAdded ;
- double ProportionRecBlocks;
- double MaxRecFactor ;
+ ogg_int32_t MotionScore;
+ ogg_uint32_t RegulationBlocks;
+ ogg_int32_t RecoveryMotionScore;
+ int RecoveryBlocksAdded ;
+ double ProportionRecBlocks;
+ double MaxRecFactor ;
/* Rate Targeting variables. */
- UINT32 ThisFrameTargetBytes;
- double BpbCorrectionFactor;
+ ogg_uint32_t ThisFrameTargetBytes;
+ double BpbCorrectionFactor;
/* Up regulation variables */
- UINT32 FinalPassLastPos; /* Used to regulate a final unrestricted
- high quality pass. */
- UINT32 LastEndSB; /* Where we were in the loop last time. */
- UINT32 ResidueLastEndSB; /* Where we were in the residue update
- loop last time. */
+ ogg_uint32_t FinalPassLastPos; /* Used to regulate a final
+ unrestricted high quality
+ pass. */
+ ogg_uint32_t LastEndSB; /* Where we were in the loop
+ last time. */
+ ogg_uint32_t ResidueLastEndSB; /* Where we were in the residue
+ update loop last time. */
/* Controlling Block Selection */
- UINT32 MVChangeFactor;
- UINT32 FourMvChangeFactor;
- UINT32 MinImprovementForNewMV;
- UINT32 ExhaustiveSearchThresh;
- UINT32 MinImprovementForFourMV;
- UINT32 FourMVThreshold;
+ ogg_uint32_t MVChangeFactor;
+ ogg_uint32_t FourMvChangeFactor;
+ ogg_uint32_t MinImprovementForNewMV;
+ ogg_uint32_t ExhaustiveSearchThresh;
+ ogg_uint32_t MinImprovementForFourMV;
+ ogg_uint32_t FourMVThreshold;
/* Module shared data structures. */
- INT32 frame_target_rate;
- INT32 BaseLineFrameTargetRate;
- INT32 min_blocks_per_frame;
- UINT32 tot_bytes_old;
+ ogg_int32_t frame_target_rate;
+ ogg_int32_t BaseLineFrameTargetRate;
+ ogg_int32_t min_blocks_per_frame;
+ ogg_uint32_t tot_bytes_old;
//********************************************************************/
/* Frames Used in the selecetive convolution filtering of the Y plane. */
- UINT8 *ConvDestBuffer;
+ unsigned char *ConvDestBuffer;
YUV_BUFFER_ENTRY *yuv0ptr;
YUV_BUFFER_ENTRY *yuv1ptr;
- UINT8 *ConvDestBufferAlloc;
- YUV_BUFFER_ENTRY *yuv0ptrAlloc;
- YUV_BUFFER_ENTRY *yuv1ptrAlloc;
/*********************************************************************/
/*********************************************************************/
/* Token Buffers */
- UINT32 *OptimisedTokenListEb; /* Optimised token list extra bits */
- UINT8 *OptimisedTokenList; /* Optimised token list. */
- UINT8 *OptimisedTokenListHi; /* Optimised token list huffman
- table index */
-
- UINT32 *OptimisedTokenListEbAlloc; /* Optimised token list extra bits */
- UINT8 *OptimisedTokenListAlloc; /* Optimised token list. */
- UINT8 *OptimisedTokenListHiAlloc; /* Optimised token list
- huffman table index */
- UINT8 *OptimisedTokenListPlAlloc; /* Optimised token list
- huffman table index */
-
- UINT8 *OptimisedTokenListPl; /* Plane to which the token belongs
- Y = 0 or UV = 1 */
- INT32 OptimisedTokenCount; /* Count of Optimized tokens */
- UINT32 RunHuffIndex; /* Huffman table in force at the
- start of a run */
- UINT32 RunPlaneIndex; /* The plane (Y=0 UV=1) to which
- the first token in an EOB run
- belonged. */
-
-
- UINT32 TotTokenCount;
- INT32 TokensToBeCoded;
- INT32 TokensCoded;
+ ogg_uint32_t *OptimisedTokenListEb; /* Optimised token list extra bits */
+ unsigned char *OptimisedTokenList; /* Optimised token list. */
+ unsigned char *OptimisedTokenListHi; /* Optimised token list huffman
+ table index */
+
+ unsigned char *OptimisedTokenListPl; /* Plane to which the token
+ belongs Y = 0 or UV = 1 */
+ ogg_int32_t OptimisedTokenCount; /* Count of Optimized tokens */
+ ogg_uint32_t RunHuffIndex; /* Huffman table in force at
+ the start of a run */
+ ogg_uint32_t RunPlaneIndex; /* The plane (Y=0 UV=1) to
+ which the first token in
+ an EOB run belonged. */
+
+
+ ogg_uint32_t TotTokenCount;
+ ogg_int32_t TokensToBeCoded;
+ ogg_int32_t TokensCoded;
/********************************************************************/
/* SuperBlock, MacroBLock and Fragment Information */
/* Coded flag arrays and counters for them */
- UINT8 *PartiallyCodedFlags;
- UINT8 *PartiallyCodedMbPatterns;
- UINT8 *UncodedMbFlags;
-
- UINT8 *extra_fragments; /* extra updates not recommended by
- pre-processor */
- INT16 *OriginalDC;
-
- UINT32 *FragmentLastQ; /* Array used to keep track of quality at
- which each fragment was last
- updated. */
- UINT8 *FragTokens;
- UINT32 *FragTokenCounts; /* Number of tokens per fragment */
-
- UINT32 *RunHuffIndices;
- UINT32 *LastCodedErrorScore;
- UINT32 *ModeList;
- MOTION_VECTOR *MVList;
+ unsigned char *PartiallyCodedFlags;
+ unsigned char *PartiallyCodedMbPatterns;
+ unsigned char *UncodedMbFlags;
+
+ unsigned char *extra_fragments; /* extra updates not
+ recommended by pre-processor */
+ ogg_int16_t *OriginalDC;
+
+ ogg_uint32_t *FragmentLastQ; /* Array used to keep track of
+ quality at which each
+ fragment was last
+ updated. */
+ unsigned char *FragTokens;
+ ogg_uint32_t *FragTokenCounts; /* Number of tokens per fragment */
+
+ ogg_uint32_t *RunHuffIndices;
+ ogg_uint32_t *LastCodedErrorScore;
+ ogg_uint32_t *ModeList;
+ MOTION_VECTOR *MVList;
- UINT8 *BlockCodedFlags;
+ unsigned char *BlockCodedFlags;
- UINT32 MvListCount;
- UINT32 ModeListCount;
+ ogg_uint32_t MvListCount;
+ ogg_uint32_t ModeListCount;
- UINT8 *DataOutputBuffer;
+ unsigned char *DataOutputBuffer;
/*********************************************************************/
- UINT32 RunLength;
- UINT32 MaxBitTarget; /* Cut off target for rate capping */
- double BitRateCapFactor; /* Factor relating normal frame target
- to cut off target. */
+ ogg_uint32_t RunLength;
+ ogg_uint32_t MaxBitTarget; /* Cut off target for rate capping */
+ double BitRateCapFactor; /* Factor relating normal frame target
+ to cut off target. */
- UINT8 MBCodingMode; /* Coding mode flags */
+ unsigned char MBCodingMode; /* Coding mode flags */
- INT32 MVPixelOffsetY[MAX_SEARCH_SITES];
- UINT32 InterTripOutThresh;
- UINT8 MVEnabled;
- UINT32 MotionVectorSearchCount;
- UINT32 FrameMVSearcOunt;
- INT32 MVSearchSteps;
- INT32 MVOffsetX[MAX_SEARCH_SITES];
- INT32 MVOffsetY[MAX_SEARCH_SITES];
- INT32 HalfPixelRef2Offset[9]; /* Offsets for half pixel compensation */
- INT8 HalfPixelXOffset[9]; /* Half pixel MV offsets for X */
- INT8 HalfPixelYOffset[9]; /* Half pixel MV offsets for Y */
-
- UINT32 bit_pattern ;
- UINT8 bits_so_far ;
- UINT32 lastval ;
- UINT32 lastrun ;
-
- Q_LIST_ENTRY *quantized_list;
- Q_LIST_ENTRY *quantized_listAlloc;
-
- MOTION_VECTOR MVector;
- UINT32 TempBitCount;
- INT16 *DCT_codes; /* Buffer that stores the result of Forward DCT */
- INT16 *DCTDataBuffer; /* Input data buffer for Forward DCT */
+ ogg_int32_t MVPixelOffsetY[MAX_SEARCH_SITES];
+ ogg_uint32_t InterTripOutThresh;
+ unsigned char MVEnabled;
+ ogg_uint32_t MotionVectorSearchCount;
+ ogg_uint32_t FrameMVSearcOunt;
+ ogg_int32_t MVSearchSteps;
+ ogg_int32_t MVOffsetX[MAX_SEARCH_SITES];
+ ogg_int32_t MVOffsetY[MAX_SEARCH_SITES];
+ ogg_int32_t HalfPixelRef2Offset[9]; /* Offsets for half pixel
+ compensation */
+ signed char HalfPixelXOffset[9]; /* Half pixel MV offsets for X */
+ signed char HalfPixelYOffset[9]; /* Half pixel MV offsets for Y */
+
+ ogg_uint32_t bit_pattern ;
+ unsigned char bits_so_far ;
+ ogg_uint32_t lastval ;
+ ogg_uint32_t lastrun ;
+
+ Q_LIST_ENTRY *quantized_list;
+ Q_LIST_ENTRY *quantized_listAlloc;
+
+ MOTION_VECTOR MVector;
+ ogg_uint32_t TempBitCount;
+ ogg_int16_t *DCT_codes; /* Buffer that stores the result of
+ Forward DCT */
+ ogg_int16_t *DCTDataBuffer; /* Input data buffer for Forward DCT */
/* Motion compensation related variables */
- UINT32 MvMaxExtent;
+ ogg_uint32_t MvMaxExtent;
- /* copied from cbitman.c */
- INT32 byte_bit_offset;
- UINT32 DataBlock;
- UINT32 mybits;
- UINT32 ByteBitsLeft;
-
- double QTargetModifier[Q_TABLE_SIZE];
+ double QTargetModifier[Q_TABLE_SIZE];
/* instances (used for reconstructing buffers and to hold tokens etc.) */
- PP_INSTANCE *pp; /* preprocessor */
- PB_INSTANCE pb; /* playback */
+ PP_INSTANCE *pp; /* preprocessor */
+ PB_INSTANCE pb; /* playback */
+
+ /* ogg bitpacker for use in packet coding, other API state */
+ oggpack_buffer oggbuffer;
+ int readyflag;
+ int packetflag;
+ int doneflag;
- /* ogg bitpacker for use in packet coding */
- oggpack_buffer oggbuffer;
+ /* how far do we shift the granulepos to seperate out P frame counts? */
+ int keyframe_granule_shift;
} CP_INSTANCE;
<p><p>1.2 +4 -4 theora/lib/misc_common.c
Index: misc_common.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/misc_common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- misc_common.c 16 Sep 2002 07:10:02 -0000 1.1
+++ misc_common.c 17 Sep 2002 07:01:33 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: misc_common.c,v 1.1 2002/09/16 07:10:02 xiphmont Exp $
+ last mod: $Id: misc_common.c,v 1.2 2002/09/17 07:01:33 xiphmont Exp $
********************************************************************/
@@ -45,7 +45,7 @@
}
void UpRegulateMB( CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
- ogg_uint32_t SB, ogg_uint32_t MB, BOOL NoCheck ) {
+ ogg_uint32_t SB, ogg_uint32_t MB, int NoCheck ) {
ogg_int32_t FragIndex;
ogg_uint32_t B;
@@ -116,7 +116,7 @@
/* Check its four Macro-Blocks */
for ( MB=(*LastMB); MB<4; MB++ ) {
/* Mark relevant blocks for update */
- UpRegulateMB( cpi, RegulationQ, SB, MB, FALSE );
+ UpRegulateMB( cpi, RegulationQ, SB, MB, 0 );
/* Keep track of the last refresh MB. */
(*LastMB) += 1;
@@ -179,7 +179,7 @@
/* Check its four Macro-Blocks */
for ( MB=LastPassMBPos; MB<4; MB++ ) {
/* Mark relevant blocks for update */
- UpRegulateMB( cpi, RegulationQ, SB, MB, TRUE );
+ UpRegulateMB( cpi, RegulationQ, SB, MB, 1 );
/* Keep track of the last refresh MB. */
LastPassMBPos += 1;
<p><p>1.2 +375 -81 theora/lib/toplevel.c
Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- toplevel.c 16 Sep 2002 07:10:02 -0000 1.1
+++ toplevel.c 17 Sep 2002 07:01:33 -0000 1.2
@@ -1,10 +1,216 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
+ * *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+ function:
+ last mod: $Id: toplevel.c,v 1.2 2002/09/17 07:01:33 xiphmont Exp $
-
-#define CommentString "Xiph.Org libTheora I 20020916"
+ ********************************************************************/
#define A_TABLE_SIZE 29
#define DF_CANDIDATE_WINDOW 5
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 0
+#define VERSION_SUB 0
+
+#define CommentString "Xiph.Org libTheora I 20020916 0 0 0"
+
+static void EDeleteFragmentInfo(CP_INSTANCE * cpi){
+ if(cpi->extra_fragments)
+ _ogg_free(cpi->extra_fragments);
+ if(cpi->FragmentLastQ)
+ _ogg_free(cpi->FragmentLastQ);
+ if(cpi->FragTokens)
+ _ogg_free(cpi->FragTokens);
+ if(cpi->FragTokenCounts)
+ _ogg_free(cpi->FragTokenCounts);
+ if(cpi->RunHuffIndices)
+ _ogg_free(cpi->RunHuffIndices);
+ if(cpi->LastCodedErrorScore)
+ _ogg_free(cpi->LastCodedErrorScore);
+ if(cpi->ModeList)
+ _ogg_free(cpi->ModeList);
+ if(cpi->MVList)
+ _ogg_free(cpi->MVList);
+ if(cpi->DCT_codes )
+ _ogg_free( cpi->DCT_codes );
+ if(cpi->DCTDataBuffer )
+ _ogg_free( cpi->DCTDataBuffer);
+ if(cpi->quantized_list)
+ _ogg_free( cpi->quantized_list);
+ if(cpi->OriginalDC)
+ _ogg_free( cpi->OriginalDC);
+ if(cpi->PartiallyCodedFlags)
+ _ogg_free(cpi->PartiallyCodedFlags);
+ if(cpi->PartiallyCodedMbPatterns)
+ _ogg_free(cpi->PartiallyCodedMbPatterns);
+ if(cpi->UncodedMbFlags)
+ _ogg_free(cpi->UncodedMbFlags);
+
+ if(cpi->BlockCodedFlags)
+ _ogg_free(cpi->BlockCodedFlags);
+
+ cpi->extra_fragments = 0;
+ cpi->FragmentLastQ = 0;
+ cpi->FragTokens = 0;
+ cpi->FragTokenCounts = 0;
+ cpi->RunHuffIndices = 0;
+ cpi->LastCodedErrorScore = 0;
+ cpi->ModeList = 0;
+ cpi->MVList = 0;
+ cpi->DCT_codes = 0;
+ cpi->DCTDataBuffer = 0;
+ cpi->quantized_list = 0;
+ cpi->OriginalDC = 0;
+ cpi->BlockCodedFlags = 0;
+}
+
+static void EAllocateFragmentInfo(CP_INSTANCE * cpi){
+
+ /* clear any existing info */
+ EDeleteFragmentInfo(cpi);
+
+ /* Perform Fragment Allocations */
+ cpi->extra_fragments =
+ _ogg_malloc(32+cpi->pb.UnitFragments*sizeof(unsigned char));
+
+ /* A note to people reading and wondering why malloc returns aren't
+ checked:
+
+ lines like the following that implement a general strategy of
+ 'check the return of malloc; a zero pointer means we're out of
+ memory!'...:
+
+ if(!cpi->extra_fragments) { EDeleteFragmentInfo(cpi); return FALSE; }
+
+ ...are not useful. It's true that many platforms follow this
+ malloc behavior, but many do not. The more modern malloc
+ strategy is only to allocate virtual pages, which are not mapped
+ until the memory on that page is touched. At *that* point, if
+ the machine is out of heap, the page fails to be mapped and a
+ SEGV is generated.
+
+ That means that is we want to deal with out of memory conditions,
+ we *must* be prepared to process a SEGV. If we implement the
+ SEGV handler, there's no reason to to check malloc return; it is
+ a waste of code. */
+
+ cpi->FragmentLastQ =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->FragmentLastQ));
+ cpi->FragTokens =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->FragTokens));
+ cpi->OriginalDC =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->OriginalDC));
+ cpi->FragTokenCounts =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->FragTokenCounts));
+ cpi->RunHuffIndices =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->RunHuffIndices));
+ cpi->LastCodedErrorScore =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->LastCodedErrorScore));
+ cpi->BlockCodedFlags =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->BlockCodedFlags));
+ cpi->ModeList =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(*cpi->ModeList));
+ cpi->MVList =
+ _ogg_malloc(cpi->pb.UnitFragments*
+ sizeof(cpi->MVList));
+ cpi->DCT_codes =
+ _ogg_malloc(64*
+ sizeof(*cpi->DCT_codes));
+ cpi->DCTDataBuffer =
+ _ogg_malloc(64*
+ sizeof(*cpi->DCTDataBuffer));
+ cpi->quantized_list =
+ _ogg_malloc(64*
+ sizeof(*cpi->quantized_list));
+ cpi->PartiallyCodedFlags =
+ _ogg_malloc(cpi->pb.MacroBlocks*
+ sizeof(*cpi->PartiallyCodedFlags));
+ cpi->PartiallyCodedMbPatterns =
+ _ogg_malloc(cpi->pb.MacroBlocks*
+ sizeof(*cpi->PartiallyCodedMbPatterns));
+ cpi->UncodedMbFlags =
+ _ogg_malloc(cpi->pb.MacroBlocks*
+ sizeof(*cpi->UncodedMbFlags));
+
+}
+
+void EDeleteFrameInfo(CP_INSTANCE * cpi) {
+ if(cpi->ConvDestBuffer )
+ _ogg_free(cpi->ConvDestBuffer );
+ cpi->ConvDestBuffer = 0;
+
+ if(cpi->yuv0ptr)
+ _ogg_free(cpi->yuv0ptr);
+ cpi->yuv0ptr = 0;
+
+ if(cpi->yuv1ptr)
+ _ogg_free(cpi->yuv1ptr);
+ cpi->yuv1ptr = 0;
+
+ if(cpi->OptimisedTokenListEb )
+ _ogg_free(cpi->OptimisedTokenListEb);
+ cpi->OptimisedTokenListEb = 0;
+
+ if(cpi->OptimisedTokenList )
+ _ogg_free(cpi->OptimisedTokenList);
+ cpi->OptimisedTokenList = 0;
+
+ if(cpi->OptimisedTokenListHi )
+ _ogg_free(cpi->OptimisedTokenListHi);
+ cpi->OptimisedTokenListHi = 0;
+
+ if(cpi->OptimisedTokenListPl )
+ _ogg_free(cpi->OptimisedTokenListPl);
+ cpi->OptimisedTokenListPl = 0;
+
+}
+
+void EateFrameInfo(CP_INSTANCE * cpi){
+ int FrameSize = cpi->pb.ReconYPlaneSize + 2 * cpi->pb.ReconUVPlaneSize;
+
+ /* clear any existing info */
+ EDeleteFrameInfo(cpi);
+
+ /* allocate frames */
+ cpi->ConvDestBuffer =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->ConvDestBuffer));
+ cpi->yuv0ptr =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->yuv0ptr));
+ cpi->yuv1ptr =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->yuv1ptr));
+ cpi->OptimisedTokenListEb =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->OptimisedTokenListEb));
+ cpi->OptimisedTokenList =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->OptimisedTokenList));
+ cpi->OptimisedTokenListHi =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->OptimisedTokenListHi));
+ cpi->OptimisedTokenListPl =
+ _ogg_malloc(FrameSize*
+ sizeof(*cpi->OptimisedTokenListPl));
+}
static void SetupKeyFrame(CP_INSTANCE *cpi) {
/* Make sure the "last frame" buffer contains the first frame data
@@ -304,7 +510,7 @@
/* (we didn't do this frame so we should have some left over for
the next frame) */
cpi->CarryOver += cpi->frame_target_rate;
- DropFrame = TRUE;
+ DropFrame = 1;
cpi->DropCount ++;
/* Adjust DropFrameTriggerBytes to account for the saving achieved. */
@@ -472,7 +678,7 @@
cpi->pb.InvLastInterDC = 0;
/* Initialise bit packing mechanism. */
- InitAddBitsToBuffer(cpi);
+ oggpackB_reset(&cpi->opb);
/* Write out the frame header information including size. */
WriteFrameHeader(cpi);
@@ -567,10 +773,63 @@
return CommentString;
}
-int theora_encode_init( CP_INSTANCE *cpi , COMP_CONFIG *CompConfig ) {
+static int _ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+int theora_encode_init(theora_state *th, theora_encode_config *c){
int i;
- InitCPInstance(cpi);
+ CP_INSTANCE *cpi;
+
+ memset(th, 0, sizeof(*th));
+ th->internal=cpi=_ogg_calloc(1,sizeof(*cpi));
+
+ c->version_major=VERSION_MAJOR;
+ c->version_minor=VERSION_MINOR;
+ c->version_subminor=VERSION_SUB;
+
+ AllocateTmpBuffers(&cpi->pb);
+ cpi->pp = CreatePPInstance();
+
+ /* Initialise Configuration structure to legal values */
+ cpi->Configuration.BaseQ = 32;
+ cpi->Configuration.FirstFrameQ = 32;
+ cpi->Configuration.MaxQ = 32;
+ cpi->Configuration.ActiveMaxQ = 32;
+
+ cpi->MVChangeFactor = 14;
+ cpi->FourMvChangeFactor = 8;
+ cpi->MinImprovementForNewMV = 25;
+ cpi->ExhaustiveSearchThresh = 2500;
+ cpi->MinImprovementForFourMV = 100;
+ cpi->FourMVThreshold = 10000;
+ cpi->BitRateCapFactor = 1.50;
+ cpi->InterTripOutThresh = 5000;
+ cpi->MVEnabled = 1;
+ cpi->InterCodeCount = 127;
+ cpi->BpbCorrectionFactor = 1.0;
+ cpi->GoldenFrameEnabled = 1;
+ cpi->InterPrediction = 1;
+ cpi->MotionCompensation = 1;
+ cpi->ThreshMapThreshold = 5;
+ cpi->QuickCompress = 1;
+ cpi->MaxConsDroppedFrames = 1;
+ cpi->Sharpness = 2;
+
+ cpi->PreProcFilterLevel = 2;
+
+ /* Set up default values for QTargetModifier[Q_TABLE_SIZE] table */
+ for ( i = 0; i < Q_TABLE_SIZE; i++ )
+ cpi->QTargetModifier[Q_TABLE_SIZE] = 1.0;
+
+ /* Set up an encode buffer */
+ oggpackB_writeinit(&cpi->opb);
for(i=0;i<=64;i++) {
if(i<=1)cpi->pb.idct[i]=IDct1;
@@ -585,36 +844,40 @@
/* Set the video frame size. */
cpi->pb.YPlaneSize = 0xFFF;
- cpi->pb.Configuration.VideoFrameHeight =0xFFF;
- cpi->pb.Configuration.VideoFrameHeight =
- (CompConfig->FrameSize & 0x0000FFFF);
- cpi->pb.Configuration.VideoFrameWidth =
- ((CompConfig->FrameSize & 0xFFFF0000) >> 16);
+ cpi->pb.Configuration.VideoFrameHeight = 0xFFF;
+ cpi->pb.Configuration.VideoFrameHeight = c->height;
+ cpi->pb.Configuration.VideoFrameWidth = c->width;
/* Note the height and width in the pre-processor control structure. */
cpi->ScanConfig.VideoFrameHeight = cpi->pb.Configuration.VideoFrameHeight;
cpi->ScanConfig.VideoFrameWidth = cpi->pb.Configuration.VideoFrameWidth;
/* Set data rate related variables. */
- cpi->Configuration.TargetBandwidth = (CompConfig->TargetBitRate * 1000) / 8;
+ cpi->Configuration.TargetBandwidth = (c->target_bitrate * 1000) / 8;
/* Set the target minimum key frame frequency */
- cpi->KeyFrameFrequency = CompConfig->KeyFrameFrequency;
+ cpi->KeyFrameFrequency = c->keyframe_frequency;
/* Set key frame data rate target */
- cpi->KeyFrameDataTarget = (CompConfig->KeyFrameDataTarget * 1000) / 8;
+ cpi->KeyFrameDataTarget = (c->keyframe_data_target_bitrate * 1000) / 8;
/* Set the quality settings. */
- ConfigureQuality( cpi, CompConfig->Quality );
+ ConfigureQuality( cpi, c->quality );
/* Set the frame rate variables. */
- cpi->Configuration.OutputFrameRate = CompConfig->FrameRate;
- if ( cpi->Configuration.OutputFrameRate < 1 )
- cpi->Configuration.OutputFrameRate = 1;
- else if ( cpi->Configuration.OutputFrameRate > 30 )
- cpi->Configuration.OutputFrameRate = 30;
- cpi->frame_target_rate =
- (cpi->Configuration.TargetBandwidth / cpi->Configuration.OutputFrameRate);
+ cpi->Configuration.OutputFrameRateN = c->fps_numerator;
+ cpi->Configuration.OutputFrameRateD = c->fps_denominator;
+ if ( cpi->Configuration.OutputFrameRateN < 1 )
+ cpi->Configuration.OutputFrameRateN = 1;
+ if ( cpi->Configuration.OutputFrameRateD < 1 )
+ cpi->Configuration.OutputFrameRateD = 1;
+
+ cpi->Configuration.OutputFrameRate =
+ (double)( cpi->Configuration.OutputFrameRateN /
+ cpi->Configuration.OutputFrameRateD );
+
+ cpi->frame_target_rate = cpi->Configuration.TargetBandwidth /
+ cpi->Configuration.OutputFrameRate;
/* Initialise image format details */
if(!InitFrameDetails(&cpi->pb)){
@@ -654,15 +917,26 @@
}
/* Set encoder flags. */
- cpi->DropFramesAllowed = CompConfig->AllowDF;
- cpi->QuickCompress = CompConfig->QuickCompress;
- cpi->AutoKeyFrameEnabled = CompConfig->AutoKeyFrameEnabled;
- cpi->MinimumDistanceToKeyFrame = CompConfig->MinimumDistanceToKeyFrame;
- cpi->ForceKeyFrameEvery = CompConfig->ForceKeyFrameEvery;
- cpi->PreProcFilterLevel = CompConfig->NoiseSensitivity;
- cpi->AutoKeyFrameThreshold = CompConfig->AutoKeyFrameThreshold;
- cpi->Sharpness = CompConfig->Sharpness;
-
+ cpi->DropFramesAllowed = c->droppedframes_p;
+ cpi->QuickCompress = c->quickcompress_p;
+ cpi->AutoKeyFrameEnabled = 1;
+ cpi->MinimumDistanceToKeyFrame = c->keyframe_mindistance;
+ cpi->ForceKeyFrameEvery = c->keyframe_force_freq;
+ cpi->PreProcFilterLevel = c->noise_sensitivity;
+ cpi->AutoKeyFrameThreshold = c->keyframe_auto_threshold;
+ cpi->Sharpness = c->sharpness;
+
+ /* don't go too nuts on keyframe spacing; impose a high limit to
+ make certain the granulepos encoding strategy works */
+ if(c->ForceKeyFrameEvery>32768)c->ForceKeyFrameEvery=32768;
+ if(c->MinimumDistanceToKeyFrame>32768)c->MinimumDistanceToKeyFrame=32768;
+
+ {
+ long maxPframes=c->ForceKeyFrameEvery > c->MinimumDistanceToKeyFrame ?
+ c->ForceKeyFrameEvery ; c->MinimumDistanceToKeyFrame ;
+ c->keyframe_granule_shift=_ilog(maxPframes-1);
+ }
+
/* Initialise Motion compensation */
InitMotionCompensation(cpi);
@@ -690,25 +964,28 @@
/* Indicate that the next frame to be compressed is the first in the
current clip. */
- cpi->ThisIsFirstFrame = TRUE;
+ cpi->ThisIsFirstFrame = 1;
+ int readyflag = 1;
return 0;
}
-int theora_encode_framein( CP_INSTANCE *cpi,
+int theora_encode_YUVin( CP_INSTANCE *cpi,
YUV_INPUT_BUFFER_CONFIG *YuvInputData){
ogg_int32_t i;
unsigned char *LocalDataPtr;
unsigned char *InputDataPtr;
+ if(!cpi->readyflag)return -1;
+ if(cpi->doneflag)return -1;
+
/* If frame size has changed, abort out for now */
if (YuvInputData->YHeight != (INT32)cpi->pb.Configuration.VideoFrameHeight ||
YuvInputData->YWidth != (INT32)cpi->pb.Configuration.VideoFrameWidth )
return(-1);
- /* Copy over input YUV to internal YUV buffers. */
-
+ /* Copy over input YUV to internal YUV buffers. */
/* First copy over the Y data */
LocalDataPtr = cpi->yuv1ptr;
InputDataPtr = (unsigned char *)YuvInputData->YBuffer;
@@ -737,14 +1014,17 @@
InputDataPtr += YuvInputData->UVStride;
}
+ /* Mark this as a video frame */
+ oggpackB_write(&cpi->opb,0,1);
+
/* Special case for first frame */
if ( cpi->ThisIsFirstFrame ){
CompressFirstFrame(cpi);
- cpi->ThisIsFirstFrame = FALSE;
- cpi->ThisIsKeyFrame = FALSE;
+ cpi->ThisIsFirstFrame = 0;
+ cpi->ThisIsKeyFrame = 0;
} else if ( cpi->ThisIsKeyFrame ) {
CompressKeyFrame(cpi);
- cpi->ThisIsKeyFrame = FALSE;
+ cpi->ThisIsKeyFrame = 0;
} else {
/* Compress the frame. */
CompressFrame( cpi, (unsigned int) cpi->CurrentFrame );
@@ -753,59 +1033,73 @@
/* Update stats variables. */
cpi->LastFrameSize = oggpackB_bytes(&cpi->opb);
cpi->CurrentFrame++;
+ cpi->packetflag=1;
return 0;
}
+int theora_encode_packetout( CP_INSTANCE *cpi, int last_p, ogg_packet *op){
+ long bytes=oggpackB_bytes(&cpi->opb);
+
+ if(!bytes)return(0);
+ if(!cpi->packetflag)return(0);
+ if(cpi->doneflag)return(-1);
+
+ op->packet=oggpackB_buffer(&cpi->opb);
+ op->bytes=bytes;
+ op->b_o_s=0;
+ op->e_o_s=last_p;
+
+ op->packetno=cpi->CurrentFrame;
+
+
+ op->granulepos=
+ ((cpi->CurrentFrame-cpi->LastKeyFrame+1)<<cpi->keyframe_granule_shift)+
+ cpi->LastKeyFrame-1;
- /* return whether or not we are a key frame */
- iskey=GetFrameType(&cpi->pb);
- if ( iskey == 0 )
- *is_key = 1;
- else
- *is_key = 0;
-
- return ret_val;
+ cpi->packetflag=0;
+ if(last_p)cpi->doneflag=1;
+ return 1;
}
-/****************************************************************************
- *
- * ROUTINE : StopEncoder
- *
- * INPUTS : None
- *
- * OUTPUTS : None.
- *
- * RETURNS : None .
- *
- * FUNCTION : Stops the encoder and grabber
- *
- * SPECIAL NOTES : None.
- *
- *
- * ERRORS : None.
- *
- ****************************************************************************/
-BOOL CCONV StopEncoder(CP_INSTANCE **cpi)
-{
-
- if(*cpi)
- {
-
- DeleteFragmentInfo(&(*cpi)->pb);
- DeleteFrameInfo(&(*cpi)->pb);
- EDeleteFragmentInfo((*cpi));
- EDeleteFrameInfo((*cpi));
-
- /* Re-set Output buffer. */
- (*cpi)->BufferedOutputBytes = 0;
-
- DeleteCPInstance(cpi);
+int theora_encode_header(CP_INSTANCE *cpi, ogg_packet *op){
+ /* width, height, fps, granule_shift, version */
- }
+ oggpackB_reset(&cpi->opb);
+ oggpackB_write(&cpi->opb,0x80,8);
+ oggpackB_write(&cpi->opb,'t',8);
+ oggpackB_write(&cpi->opb,'h',8);
+ oggpackB_write(&cpi->opb,'e',8);
+ oggpackB_write(&cpi->opb,'o',8);
+ oggpackB_write(&cpi->opb,'r',8);
+ oggpackB_write(&cpi->opb,'a',8);
+
+ oggpackB_write(&cpi->opb,cpi->ScanConfig.VideoFrameWidth,16);
+ oggpackB_write(&cpi->opb,cpi->ScanConfig.VideoFrameHeight,16);
+ oggpackB_write(&cpi->opb,cpi->Configuration.OutputFrameN,32);
+ oggpackB_write(&cpi->opb,cpi->Configuration.OutputFrameD,32);
+
+ oggpackB_write(&cpi->opb,cpi->keyframe_granule_shift,5);
+
+ oggpackB_write(&cpi->opb,cpi->version_major,8);
+ oggpackB_write(&cpi->opb,cpi->version_minor,8);
+ oggpackB_write(&cpi->opb,cpi->version_subminor,8);
+
+ return(0);
+}
- return TRUE;
+void theora_encode_clear(CP_INSTANCE *cpi){
+ if(cpi){
+
+ DeleteFragmentInfo(&cpi->pb);
+ DeleteFrameInfo(&cpi->pb);
+ EDeleteFragmentInfo(cpi);
+ EDeleteFrameInfo(cpi);
+ DeleteTmpBuffers(cpi->pb);
+ DeletePPInstance(cpi->pp);
+
+ }
}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list