Changeset 38
- Timestamp:
- 02/16/08 18:34:00
(6 months ago)
- Author:
- sip
- Message:
Buffer changes
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4 |
r38 |
|
| 60 | 60 | |
|---|
| 61 | 61 | //Alocamos el buffer |
|---|
| | 62 | bufSize = 1024*756*3/2; |
|---|
| 62 | 63 | buffer = (BYTE *)malloc(bufSize); |
|---|
| 63 | 64 | frame = NULL; |
|---|
| r30 |
r38 |
|
| 19 | 19 | { |
|---|
| 20 | 20 | // Set default values |
|---|
| | 21 | bufEncode = NULL; |
|---|
| 21 | 22 | codec = NULL; |
|---|
| | 23 | bufSize = 0; |
|---|
| 22 | 24 | type = H263_1998; |
|---|
| 23 | 25 | qMin = qualityMin; |
|---|
| … | … | |
| 47 | 49 | ctx = avcodec_alloc_context(); |
|---|
| 48 | 50 | picture = avcodec_alloc_frame(); |
|---|
| 49 | | |
|---|
| 50 | | //Y alocamos el buffer |
|---|
| 51 | | bufEncode = (BYTE *)malloc(bufSize); |
|---|
| 52 | 51 | } |
|---|
| 53 | 52 | |
|---|
| … | … | |
| 58 | 57 | H263Encoder::~H263Encoder() |
|---|
| 59 | 58 | { |
|---|
| 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); |
|---|
| 64 | 70 | } |
|---|
| 65 | 71 | |
|---|
| … | … | |
| 121 | 127 | return Error("Already opened\n"); |
|---|
| 122 | 128 | |
|---|
| | 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 | |
|---|
| 123 | 140 | // Bitrate,fps |
|---|
| 124 | 141 | ctx->bit_rate = bitrate; |
|---|
| 125 | | ctx->bit_rate_tolerance = bitrate/fps+1; |
|---|
| | 142 | ctx->bit_rate_tolerance = bufSize; |
|---|
| 126 | 143 | 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 | |
|---|
| 128 | 146 | // Encoder quality |
|---|
| 129 | 147 | ctx->rc_min_rate = bitrate; |
|---|
| … | … | |
| 134 | 152 | ctx->mb_qmin = ctx->qmin= qMin; |
|---|
| 135 | 153 | 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 | |
|---|
| 139 | 155 | // Flags |
|---|
| 140 | 156 | 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*/ |
|---|
| 144 | 160 | ctx->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; |
|---|
| 145 | 161 | |
|---|
| … | … | |
| 233 | 249 | // |
|---|
| 234 | 250 | ////////////////////////////////////////////////////////////////////////// |
|---|
| 235 | | DWORD H263Decoder::bufSize = 4096*16; |
|---|
| 236 | | |
|---|
| 237 | 251 | /*********************** |
|---|
| 238 | 252 | * H263Decoder |
|---|
| … | … | |
| 273 | 287 | |
|---|
| 274 | 288 | //Alocamos el buffer |
|---|
| | 289 | bufSize = 1024*756*3/2; |
|---|
| 275 | 290 | buffer = (BYTE *)malloc(bufSize); |
|---|
| 276 | 291 | frame = NULL; |
|---|
| r5 |
r38 |
|
| 34 | 34 | DWORD bufLen; |
|---|
| 35 | 35 | DWORD bufIni; |
|---|
| 36 | | static DWORD bufSize; |
|---|
| | 36 | DWORD bufSize; |
|---|
| 37 | 37 | |
|---|
| 38 | 38 | list<BYTE*> lstData; |
|---|
| … | … | |
| 58 | 58 | BYTE* buffer; |
|---|
| 59 | 59 | DWORD bufLen; |
|---|
| 60 | | static DWORD bufSize; |
|---|
| | 60 | DWORD bufSize; |
|---|
| 61 | 61 | BYTE* frame; |
|---|
| 62 | 62 | DWORD frameSize; |
|---|
Download in other formats:
|
|