Changeset 38

Show
Ignore:
Timestamp:
02/16/08 18:34:00 (6 months ago)
Author:
sip
Message:

Buffer changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • media/src/h263/h263-1996codec.cpp

    r4 r38  
    6060 
    6161        //Alocamos el buffer 
     62        bufSize = 1024*756*3/2; 
    6263        buffer = (BYTE *)malloc(bufSize); 
    6364        frame = NULL; 
  • media/src/h263/h263codec.cpp

    r30 r38  
    1919{ 
    2020        // Set default values 
     21        bufEncode  = NULL; 
    2122        codec   = NULL; 
     23        bufSize = 0; 
    2224        type    = H263_1998; 
    2325        qMin    = qualityMin; 
     
    4749        ctx = avcodec_alloc_context(); 
    4850        picture = avcodec_alloc_frame(); 
    49  
    50         //Y alocamos el buffer 
    51         bufEncode = (BYTE *)malloc(bufSize); 
    5251} 
    5352 
     
    5857H263Encoder::~H263Encoder() 
    5958{ 
    60         free(bufEncode); 
    61         avcodec_close(ctx); 
    62         free(ctx); 
    63         free(picture); 
     59        if (bufEncode); 
     60                free(bufEncode); 
     61 
     62        if (ctx) 
     63        { 
     64                avcodec_close(ctx); 
     65                free(ctx); 
     66        } 
     67 
     68        if (picture) 
     69                free(picture); 
    6470} 
    6571 
     
    121127                return Error("Already opened\n"); 
    122128 
     129        //If already got a buffer 
     130        if (bufEncode) 
     131                //Free it 
     132                free(bufEncode); 
     133 
     134        //Set new buffer size 
     135        bufSize = (int)bitrate/fps+1; 
     136 
     137        //Y alocamos el buffer 
     138        bufEncode = (BYTE *)malloc(bufSize); 
     139 
    123140        // Bitrate,fps 
    124141        ctx->bit_rate           = bitrate; 
    125         ctx->bit_rate_tolerance = bitrate/fps+1
     142        ctx->bit_rate_tolerance = bufSize
    126143        ctx->time_base          = (AVRational){1,fps}; 
    127         ctx->gop_size           = (int)(fps*10);        // about one Intra frame per ten seconds 
     144        ctx->gop_size           = (int)(fps*15);        // about one Intra frame per ten seconds 
     145 
    128146        // Encoder quality 
    129147        ctx->rc_min_rate        = bitrate; 
     
    134152        ctx->mb_qmin = ctx->qmin= qMin; 
    135153        ctx->mb_qmax = ctx->qmax= qMax; 
    136         //ctx->i_quant_factor   = (float)-0.6; 
    137         //ctx->i_quant_offset   = (float)0.0; 
    138         //ctx->b_quant_factor   = (float)1.5; 
     154 
    139155        // Flags 
    140156        ctx->flags |= CODEC_FLAG_PASS1;                 //PASS1  
    141         ctx->flags &= ~CODEC_FLAG_H263P_UMV;          //unrestricted motion vector 
    142         ctx->flags &= ~CODEC_FLAG_4MV;                        //advanced prediction 
    143         ctx->flags &= ~CODEC_FLAG_H263P_AIC;          //advanced intra coding*/ 
     157        ctx->flags |= CODEC_FLAG_H263P_UMV;           //unrestricted motion vector 
     158        ctx->flags |= CODEC_FLAG_4MV;                 //advanced prediction 
     159        ctx->flags |= CODEC_FLAG_H263P_AIC;           //advanced intra coding*/ 
    144160        ctx->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; 
    145161 
     
    233249// 
    234250////////////////////////////////////////////////////////////////////////// 
    235 DWORD H263Decoder::bufSize = 4096*16; 
    236  
    237251/*********************** 
    238252* H263Decoder 
     
    273287 
    274288        //Alocamos el buffer 
     289        bufSize = 1024*756*3/2; 
    275290        buffer = (BYTE *)malloc(bufSize); 
    276291        frame = NULL; 
  • media/src/h263/h263codec.h

    r5 r38  
    3434        DWORD           bufLen; 
    3535        DWORD           bufIni; 
    36         static DWORD  bufSize; 
     36        DWORD         bufSize; 
    3737 
    3838        list<BYTE*>     lstData; 
     
    5858        BYTE*           buffer; 
    5959        DWORD           bufLen; 
    60         static DWORD bufSize; 
     60        DWORD         bufSize; 
    6161        BYTE*           frame; 
    6262        DWORD           frameSize; 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software