00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #include "avcodec.h"
00029 #include "dsputil.h"
00030 #include "mpegvideo.h"
00031 #include "integer.h"
00032 #include "opt.h"
00033 #include "crc.h"
00034 #include <stdarg.h>
00035 #include <limits.h>
00036 #include <float.h>
00037 #if !defined(HAVE_MKSTEMP)
00038 #include <fcntl.h>
00039 #endif
00040
00041 const uint8_t ff_reverse[256]={
00042 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
00043 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
00044 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
00045 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
00046 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
00047 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
00048 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
00049 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
00050 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
00051 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
00052 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
00053 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
00054 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
00055 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
00056 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
00057 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
00058 };
00059
00060 static int volatile entangled_thread_counter=0;
00061
00062 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
00063 {
00064 if(min_size < *size)
00065 return ptr;
00066
00067 *size= FFMAX(17*min_size/16 + 32, min_size);
00068
00069 return av_realloc(ptr, *size);
00070 }
00071
00072 static unsigned int last_static = 0;
00073 static unsigned int allocated_static = 0;
00074 static void** array_static = NULL;
00075
00076 void *av_mallocz_static(unsigned int size)
00077 {
00078 void *ptr = av_mallocz(size);
00079
00080 if(ptr){
00081 array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1));
00082 if(!array_static)
00083 return NULL;
00084 array_static[last_static++] = ptr;
00085 }
00086
00087 return ptr;
00088 }
00089
00090 void *ff_realloc_static(void *ptr, unsigned int size)
00091 {
00092 int i;
00093 if(!ptr)
00094 return av_mallocz_static(size);
00095
00096 for(i = 0; i < last_static; i++) {
00097 if(array_static[i] == ptr) {
00098 array_static[i] = av_realloc(array_static[i], size);
00099 return array_static[i];
00100 }
00101 }
00102 return NULL;
00103
00104 }
00105
00106 void av_free_static(void)
00107 {
00108 while(last_static){
00109 av_freep(&array_static[--last_static]);
00110 }
00111 av_freep(&array_static);
00112 }
00113
00118 static void do_free(void) __attribute__ ((destructor));
00119
00120 static void do_free(void)
00121 {
00122 av_free_static();
00123 }
00124
00125
00126
00127 AVCodec *first_avcodec = NULL;
00128
00129 AVCodec *av_codec_next(AVCodec *c){
00130 if(c) return c->next;
00131 else return first_avcodec;
00132 }
00133
00134 void register_avcodec(AVCodec *format)
00135 {
00136 AVCodec **p;
00137 p = &first_avcodec;
00138 while (*p != NULL) p = &(*p)->next;
00139 *p = format;
00140 format->next = NULL;
00141 }
00142
00143 void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
00144 s->coded_width = width;
00145 s->coded_height= height;
00146 s->width = -((-width )>>s->lowres);
00147 s->height= -((-height)>>s->lowres);
00148 }
00149
00150 typedef struct InternalBuffer{
00151 int last_pic_num;
00152 uint8_t *base[4];
00153 uint8_t *data[4];
00154 int linesize[4];
00155 int width, height;
00156 enum PixelFormat pix_fmt;
00157 }InternalBuffer;
00158
00159 #define INTERNAL_BUFFER_SIZE 32
00160
00161 #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
00162
00163 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
00164 int w_align= 1;
00165 int h_align= 1;
00166
00167 switch(s->pix_fmt){
00168 case PIX_FMT_YUV420P:
00169 case PIX_FMT_YUYV422:
00170 case PIX_FMT_UYVY422:
00171 case PIX_FMT_YUV422P:
00172 case PIX_FMT_YUV444P:
00173 case PIX_FMT_GRAY8:
00174 case PIX_FMT_GRAY16BE:
00175 case PIX_FMT_GRAY16LE:
00176 case PIX_FMT_YUVJ420P:
00177 case PIX_FMT_YUVJ422P:
00178 case PIX_FMT_YUVJ444P:
00179 case PIX_FMT_YUVA420P:
00180 w_align= 16;
00181 h_align= 16;
00182 break;
00183 case PIX_FMT_YUV411P:
00184 case PIX_FMT_UYYVYY411:
00185 w_align=32;
00186 h_align=8;
00187 break;
00188 case PIX_FMT_YUV410P:
00189 if(s->codec_id == CODEC_ID_SVQ1){
00190 w_align=64;
00191 h_align=64;
00192 }
00193 case PIX_FMT_RGB555:
00194 if(s->codec_id == CODEC_ID_RPZA){
00195 w_align=4;
00196 h_align=4;
00197 }
00198 case PIX_FMT_PAL8:
00199 if(s->codec_id == CODEC_ID_SMC){
00200 w_align=4;
00201 h_align=4;
00202 }
00203 break;
00204 case PIX_FMT_BGR24:
00205 if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){
00206 w_align=4;
00207 h_align=4;
00208 }
00209 break;
00210 default:
00211 w_align= 1;
00212 h_align= 1;
00213 break;
00214 }
00215
00216 *width = ALIGN(*width , w_align);
00217 *height= ALIGN(*height, h_align);
00218 }
00219
00220 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
00221 if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/4)
00222 return 0;
00223
00224 av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
00225 return -1;
00226 }
00227
00228 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
00229 int i;
00230 int w= s->width;
00231 int h= s->height;
00232 InternalBuffer *buf;
00233 int *picture_number;
00234
00235 if(pic->data[0]!=NULL) {
00236 av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
00237 return -1;
00238 }
00239 if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {
00240 av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n");
00241 return -1;
00242 }
00243
00244 if(avcodec_check_dimensions(s,w,h))
00245 return -1;
00246
00247 if(s->internal_buffer==NULL){
00248 s->internal_buffer= av_mallocz(INTERNAL_BUFFER_SIZE*sizeof(InternalBuffer));
00249 }
00250 #if 0
00251 s->internal_buffer= av_fast_realloc(
00252 s->internal_buffer,
00253 &s->internal_buffer_size,
00254 sizeof(InternalBuffer)*FFMAX(99, s->internal_buffer_count+1)
00255 );
00256 #endif
00257
00258 buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
00259 picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num;
00260 (*picture_number)++;
00261
00262 if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
00263 for(i=0; i<4; i++){
00264 av_freep(&buf->base[i]);
00265 buf->data[i]= NULL;
00266 }
00267 }
00268
00269 if(buf->base[0]){
00270 pic->age= *picture_number - buf->last_pic_num;
00271 buf->last_pic_num= *picture_number;
00272 }else{
00273 int h_chroma_shift, v_chroma_shift;
00274 int pixel_size, size[4];
00275 AVPicture picture;
00276
00277 avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
00278
00279 avcodec_align_dimensions(s, &w, &h);
00280
00281 if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
00282 w+= EDGE_WIDTH*2;
00283 h+= EDGE_WIDTH*2;
00284 }
00285 avcodec_align_dimensions(s, &w, &h);
00286
00287 avpicture_fill(&picture, NULL, s->pix_fmt, w, h);
00288 pixel_size= picture.linesize[0]*8 / w;
00289
00290 assert(pixel_size>=1);
00291
00292 if(pixel_size == 3*8)
00293 w= ALIGN(w, STRIDE_ALIGN<<h_chroma_shift);
00294 else
00295 w= ALIGN(pixel_size*w, STRIDE_ALIGN<<(h_chroma_shift+3)) / pixel_size;
00296 size[1] = avpicture_fill(&picture, NULL, s->pix_fmt, w, h);
00297 size[0] = picture.linesize[0] * h;
00298 size[1] -= size[0];
00299 size[2] = size[3] = 0;
00300 if(picture.data[2])
00301 size[1]= size[2]= size[1]/2;
00302 if(picture.data[3])
00303 size[3] = picture.linesize[3] * h;
00304
00305 buf->last_pic_num= -256*256*256*64;
00306 memset(buf->base, 0, sizeof(buf->base));
00307 memset(buf->data, 0, sizeof(buf->data));
00308
00309 for(i=0; i<4 && size[i]; i++){
00310 const int h_shift= i==0 ? 0 : h_chroma_shift;
00311 const int v_shift= i==0 ? 0 : v_chroma_shift;
00312
00313 buf->linesize[i]= picture.linesize[i];
00314
00315 buf->base[i]= av_malloc(size[i]+16);
00316 if(buf->base[i]==NULL) return -1;
00317 memset(buf->base[i], 128, size[i]);
00318
00319
00320 if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2])
00321 buf->data[i] = buf->base[i];
00322 else
00323 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN);
00324 }
00325 buf->width = s->width;
00326 buf->height = s->height;
00327 buf->pix_fmt= s->pix_fmt;
00328 pic->age= 256*256*256*64;
00329 }
00330 pic->type= FF_BUFFER_TYPE_INTERNAL;
00331
00332 for(i=0; i<4; i++){
00333 pic->base[i]= buf->base[i];
00334 pic->data[i]= buf->data[i];
00335 pic->linesize[i]= buf->linesize[i];
00336 }
00337 s->internal_buffer_count++;
00338
00339 return 0;
00340 }
00341
00342 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
00343 int i;
00344 InternalBuffer *buf, *last;
00345
00346 assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
00347 assert(s->internal_buffer_count);
00348
00349 buf = NULL;
00350 for(i=0; i<s->internal_buffer_count; i++){
00351 buf= &((InternalBuffer*)s->internal_buffer)[i];
00352 if(buf->data[0] == pic->data[0])
00353 break;
00354 }
00355 assert(i < s->internal_buffer_count);
00356 s->internal_buffer_count--;
00357 last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
00358
00359 FFSWAP(InternalBuffer, *buf, *last);
00360
00361 for(i=0; i<4; i++){
00362 pic->data[i]=NULL;
00363
00364 }
00365
00366 }
00367
00368 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
00369 AVFrame temp_pic;
00370 int i;
00371
00372
00373 if(pic->data[0] == NULL) {
00374
00375 pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
00376 return s->get_buffer(s, pic);
00377 }
00378
00379
00380 if(pic->type == FF_BUFFER_TYPE_INTERNAL)
00381 return 0;
00382
00383
00384
00385
00386 temp_pic = *pic;
00387 for(i = 0; i < 4; i++)
00388 pic->data[i] = pic->base[i] = NULL;
00389 pic->opaque = NULL;
00390
00391 if (s->get_buffer(s, pic))
00392 return -1;
00393
00394 av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
00395 s->height);
00396 s->release_buffer(s, &temp_pic);
00397 return 0;
00398 }
00399
00400 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){
00401 int i;
00402
00403 for(i=0; i<count; i++){
00404 int r= func(c, arg[i]);
00405 if(ret) ret[i]= r;
00406 }
00407 return 0;
00408 }
00409
00410 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt){
00411 return fmt[0];
00412 }
00413
00414 static const char* context_to_name(void* ptr) {
00415 AVCodecContext *avc= ptr;
00416
00417 if(avc && avc->codec && avc->codec->name)
00418 return avc->codec->name;
00419 else
00420 return "NULL";
00421 }
00422
00423 #define OFFSET(x) offsetof(AVCodecContext,x)
00424 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
00425
00426 #define V AV_OPT_FLAG_VIDEO_PARAM
00427 #define A AV_OPT_FLAG_AUDIO_PARAM
00428 #define S AV_OPT_FLAG_SUBTITLE_PARAM
00429 #define E AV_OPT_FLAG_ENCODING_PARAM
00430 #define D AV_OPT_FLAG_DECODING_PARAM
00431
00432 #define AV_CODEC_DEFAULT_BITRATE 200*1000
00433
00434 static const AVOption options[]={
00435 {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|E},
00436 {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, 64*1000, INT_MIN, INT_MAX, A|E},
00437 {"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, 1, INT_MAX, V|E},
00438 {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"},
00439 {"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"},
00440 {"obmc", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"},
00441 {"qpel", "use 1/4 pel motion compensation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QPEL, INT_MIN, INT_MAX, V|E, "flags"},
00442 {"loop", "use loop filter", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOOP_FILTER, INT_MIN, INT_MAX, V|E, "flags"},
00443 {"qscale", "use fixed qscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QSCALE, INT_MIN, INT_MAX, 0, "flags"},
00444 {"gmc", "use gmc", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GMC, INT_MIN, INT_MAX, V|E, "flags"},
00445 {"mv0", "always try a mb with mv=<0,0>", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_MV0, INT_MIN, INT_MAX, V|E, "flags"},
00446 {"part", "use data partitioning", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PART, INT_MIN, INT_MAX, V|E, "flags"},
00447 {"input_preserved", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INPUT_PRESERVED, INT_MIN, INT_MAX, 0, "flags"},
00448 {"pass1", "use internal 2pass ratecontrol in first pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS1, INT_MIN, INT_MAX, 0, "flags"},
00449 {"pass2", "use internal 2pass ratecontrol in second pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS2, INT_MIN, INT_MAX, 0, "flags"},
00450 {"extern_huff", "use external huffman table (for mjpeg)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EXTERN_HUFF, INT_MIN, INT_MAX, 0, "flags"},
00451 {"gray", "only decode/encode grayscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GRAY, INT_MIN, INT_MAX, V|E|D, "flags"},
00452 {"emu_edge", "don't draw edges", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EMU_EDGE, INT_MIN, INT_MAX, 0, "flags"},
00453 {"psnr", "error[?] variables will be set during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PSNR, INT_MIN, INT_MAX, V|E, "flags"},
00454 {"truncated", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRUNCATED, INT_MIN, INT_MAX, 0, "flags"},
00455 {"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags"},
00456 {"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"},
00457 {"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D|E, "flags"},
00458 {"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"},
00459 {"trell", "use trellis quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRELLIS_QUANT, INT_MIN, INT_MAX, V|E, "flags"},
00460 {"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, 0, "flags"},
00461 {"bitexact", "use only bitexact stuff (except (i)dct)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_BITEXACT, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
00462 {"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_AC_PRED, INT_MIN, INT_MAX, V|E, "flags"},
00463 {"umv", "use unlimited motion vectors", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_UMV, INT_MIN, INT_MAX, V|E, "flags"},
00464 {"cbp", "use rate distortion optimization for cbp", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CBP_RD, INT_MIN, INT_MAX, V|E, "flags"},
00465 {"qprd", "use rate distortion optimization for qp selection", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QP_RD, INT_MIN, INT_MAX, V|E, "flags"},
00466 {"aiv", "h263 alternative inter vlc", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_AIV, INT_MIN, INT_MAX, V|E, "flags"},
00467 {"slice", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_SLICE_STRUCT, INT_MIN, INT_MAX, V|E, "flags"},
00468 {"ilme", "interlaced motion estimation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_ME, INT_MIN, INT_MAX, V|E, "flags"},
00469 {"scan_offset", "will reserve space for svcd scan offset user data", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_SVCD_SCAN_OFFSET, INT_MIN, INT_MAX, V|E, "flags"},
00470 {"cgop", "closed gop", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CLOSED_GOP, INT_MIN, INT_MAX, V|E, "flags"},
00471 {"fast", "allow non spec compliant speedup tricks", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FAST, INT_MIN, INT_MAX, V|E, "flags2"},
00472 {"sgop", "strictly enforce gop size", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_STRICT_GOP, INT_MIN, INT_MAX, V|E, "flags2"},
00473 {"noout", "skip bitstream encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NO_OUTPUT, INT_MIN, INT_MAX, V|E, "flags2"},
00474 {"local_header", "place global headers at every keyframe instead of in extradata", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_LOCAL_HEADER, INT_MIN, INT_MAX, V|E, "flags2"},
00475 {"sub_id", NULL, OFFSET(sub_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00476 {"me_method", "set motion estimation method", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"},
00477 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
00478 {"me", "set motion estimation method (deprecated, use me_method instead)", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"},
00479 #endif
00480 {"zero", "zero motion estimation (fastest)", 0, FF_OPT_TYPE_CONST, ME_ZERO, INT_MIN, INT_MAX, V|E, "me_method" },
00481 {"full", "full motion estimation (slowest)", 0, FF_OPT_TYPE_CONST, ME_FULL, INT_MIN, INT_MAX, V|E, "me_method" },
00482 {"epzs", "EPZS motion estimation (default)", 0, FF_OPT_TYPE_CONST, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method" },
00483 {"log", "log motion estimation", 0, FF_OPT_TYPE_CONST, ME_LOG, INT_MIN, INT_MAX, V|E, "me_method" },
00484 {"phods", "phods motion estimation", 0, FF_OPT_TYPE_CONST, ME_PHODS, INT_MIN, INT_MAX, V|E, "me_method" },
00485 {"x1", "X1 motion estimation", 0, FF_OPT_TYPE_CONST, ME_X1, INT_MIN, INT_MAX, V|E, "me_method" },
00486 {"hex", "hex motion estimation", 0, FF_OPT_TYPE_CONST, ME_HEX, INT_MIN, INT_MAX, V|E, "me_method" },
00487 {"umh", "umh motion estimation", 0, FF_OPT_TYPE_CONST, ME_UMH, INT_MIN, INT_MAX, V|E, "me_method" },
00488 {"iter", "iter motion estimation", 0, FF_OPT_TYPE_CONST, ME_ITER, INT_MIN, INT_MAX, V|E, "me_method" },
00489 {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00490 {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
00491 {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},
00492 {"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00493 {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00494 {"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00495 {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
00496 {"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
00497 {"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00498 {"real_pict_num", NULL, OFFSET(real_pict_num), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00499 {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00500 {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, FLT_MIN, FLT_MAX, V|E},
00501 {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, FLT_MIN, FLT_MAX, V|E},
00502 {"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 1, 51, V|E},
00503 {"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 1, 51, V|E},
00504 {"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E},
00505 {"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E},
00506 {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E},
00507 {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00508 {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
00509 {"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
00510 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
00511 {"rtp_mode", NULL, OFFSET(rtp_mode), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00512 #endif
00513 {"ps", "rtp payload size in bits", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00514 {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00515 {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00516 {"i_tex_bits", NULL, OFFSET(i_tex_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00517 {"p_tex_bits", NULL, OFFSET(p_tex_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00518 {"i_count", NULL, OFFSET(i_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00519 {"p_count", NULL, OFFSET(p_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00520 {"skip_count", NULL, OFFSET(skip_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00521 {"misc_bits", NULL, OFFSET(misc_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00522 {"frame_bits", NULL, OFFSET(frame_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00523 {"codec_tag", NULL, OFFSET(codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00524 {"bug", "workaround not auto detected encoder bugs", OFFSET(workaround_bugs), FF_OPT_TYPE_FLAGS, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"},
00525 {"autodetect", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"},
00526 {"old_msmpeg4", "some old lavc generated msmpeg4v3 files (no autodetection)", 0, FF_OPT_TYPE_CONST, FF_BUG_OLD_MSMPEG4, INT_MIN, INT_MAX, V|D, "bug"},
00527 {"xvid_ilace", "Xvid interlacing bug (autodetected if fourcc==XVIX)", 0, FF_OPT_TYPE_CONST, FF_BUG_XVID_ILACE, INT_MIN, INT_MAX, V|D, "bug"},
00528 {"ump4", "(autodetected if fourcc==UMP4)", 0, FF_OPT_TYPE_CONST, FF_BUG_UMP4, INT_MIN, INT_MAX, V|D, "bug"},
00529 {"no_padding", "padding bug (autodetected)", 0, FF_OPT_TYPE_CONST, FF_BUG_NO_PADDING, INT_MIN, INT_MAX, V|D, "bug"},
00530 {"amv", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AMV, INT_MIN, INT_MAX, V|D, "bug"},
00531 {"ac_vlc", "illegal vlc bug (autodetected per fourcc)", 0, FF_OPT_TYPE_CONST, FF_BUG_AC_VLC, INT_MIN, INT_MAX, V|D, "bug"},
00532 {"qpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"},
00533 {"std_qpel", "old standard qpel (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_STD_QPEL, INT_MIN, INT_MAX, V|D, "bug"},
00534 {"qpel_chroma2", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA2, INT_MIN, INT_MAX, V|D, "bug"},
00535 {"direct_blocksize", "direct-qpel-blocksize bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_DIRECT_BLOCKSIZE, INT_MIN, INT_MAX, V|D, "bug"},
00536 {"edge", "edge padding bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_EDGE, INT_MIN, INT_MAX, V|D, "bug"},
00537 {"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_HPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"},
00538 {"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DC_CLIP, INT_MIN, INT_MAX, V|D, "bug"},
00539 {"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"},
00540 {"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00541 {"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00542 {"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|D, "strict"},
00543 {"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|E, "strict"},
00544 {"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|E, "strict"},
00545 {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|E, "strict"},
00546 {"inofficial", "allow inofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|E, "strict"},
00547 {"experimental", "allow non standardized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|E, "strict"},
00548 {"b_qoffset", "qp offset between p and b frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E},
00549 {"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, A|V|D, "er"},
00550 {"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"},
00551 {"compliant", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_COMPLIANT, INT_MIN, INT_MAX, V|D, "er"},
00552 {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"},
00553 {"very_aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_VERY_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"},
00554 {"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00555 {"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00556 {"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00557 {"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00558 {"stats_out", NULL, OFFSET(stats_out), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX},
00559 {"stats_in", NULL, OFFSET(stats_in), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX},
00560 {"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 99, V|E},
00561 {"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
00562 {"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00563 {"rc_override_count", NULL, OFFSET(rc_override_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00564 {"rc_eq", "set rate control equation", OFFSET(rc_eq), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX, V|E},
00565 {"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00566 {"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00567 {"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|E},
00568 {"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, FLT_MIN, FLT_MAX, V|E},
00569 {"i_qfactor", "qp factor between p and i frames", OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, -0.8, -FLT_MAX, FLT_MAX, V|E},
00570 {"i_qoffset", "qp offset between p and i frames", OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, 0.0, -FLT_MAX, FLT_MAX, V|E},
00571 {"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
00572 {"dct", "DCT algorithm", OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E, "dct"},
00573 {"auto", "autoselect a good one (default)", 0, FF_OPT_TYPE_CONST, FF_DCT_AUTO, INT_MIN, INT_MAX, V|E, "dct"},
00574 {"fastint", "fast integer", 0, FF_OPT_TYPE_CONST, FF_DCT_FASTINT, INT_MIN, INT_MAX, V|E, "dct"},
00575 {"int", "accurate integer", 0, FF_OPT_TYPE_CONST, FF_DCT_INT, INT_MIN, INT_MAX, V|E, "dct"},
00576 {"mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MMX, INT_MIN, INT_MAX, V|E, "dct"},
00577 {"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MLIB, INT_MIN, INT_MAX, V|E, "dct"},
00578 {"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_ALTIVEC, INT_MIN, INT_MAX, V|E, "dct"},
00579 {"faan", "floating point AAN DCT", 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"},
00580 {"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
00581 {"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
00582 {"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
00583 {"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
00584 {"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
00585 {"unused", NULL, OFFSET(unused), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00586 {"idct", "select IDCT implementation", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"},
00587 {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"},
00588 {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"},
00589 {"simple", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLE, INT_MIN, INT_MAX, V|E|D, "idct"},
00590 {"simplemmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEMMX, INT_MIN, INT_MAX, V|E|D, "idct"},
00591 {"libmpeg2mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_LIBMPEG2MMX, INT_MIN, INT_MAX, V|E|D, "idct"},
00592 {"ps2", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_PS2, INT_MIN, INT_MAX, V|E|D, "idct"},
00593 {"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_MLIB, INT_MIN, INT_MAX, V|E|D, "idct"},
00594 {"arm", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ARM, INT_MIN, INT_MAX, V|E|D, "idct"},
00595 {"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ALTIVEC, INT_MIN, INT_MAX, V|E|D, "idct"},
00596 {"sh4", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SH4, INT_MIN, INT_MAX, V|E|D, "idct"},
00597 {"simplearm", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARM, INT_MIN, INT_MAX, V|E|D, "idct"},
00598 {"simplearmv5te", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARMV5TE, INT_MIN, INT_MAX, V|E|D, "idct"},
00599 {"h264", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_H264, INT_MIN, INT_MAX, V|E|D, "idct"},
00600 {"vp3", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_VP3, INT_MIN, INT_MAX, V|E|D, "idct"},
00601 {"ipp", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_IPP, INT_MIN, INT_MAX, V|E|D, "idct"},
00602 {"xvidmmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_XVIDMMX, INT_MIN, INT_MAX, V|E|D, "idct"},
00603 {"slice_count", NULL, OFFSET(slice_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00604 {"ec", "set error concealment strategy", OFFSET(error_concealment), FF_OPT_TYPE_FLAGS, 3, INT_MIN, INT_MAX, V|D, "ec"},
00605 {"guess_mvs", "iterative motion vector (MV) search (slow)", 0, FF_OPT_TYPE_CONST, FF_EC_GUESS_MVS, INT_MIN, INT_MAX, V|D, "ec"},
00606 {"deblock", "use strong deblock filter for damaged MBs", 0, FF_OPT_TYPE_CONST, FF_EC_DEBLOCK, INT_MIN, INT_MAX, V|D, "ec"},
00607 {"bits_per_sample", NULL, OFFSET(bits_per_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00608 {"pred", "prediction method", OFFSET(prediction_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "pred"},
00609 {"left", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_LEFT, INT_MIN, INT_MAX, V|E, "pred"},
00610 {"plane", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_PLANE, INT_MIN, INT_MAX, V|E, "pred"},
00611 {"median", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_MEDIAN, INT_MIN, INT_MAX, V|E, "pred"},
00612 {"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E},
00613 {"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, V|A|S|E|D, "debug"},
00614 {"pict", "picture info", 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"},
00615 {"rc", "rate control", 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"},
00616 {"bitstream", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BITSTREAM, INT_MIN, INT_MAX, V|D, "debug"},
00617 {"mb_type", "macroblock (MB) type", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"},
00618 {"qp", "per-block quantization parameter (QP)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_QP, INT_MIN, INT_MAX, V|D, "debug"},
00619 {"mv", "motion vector", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MV, INT_MIN, INT_MAX, V|D, "debug"},
00620 {"dct_coeff", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_DCT_COEFF, INT_MIN, INT_MAX, V|D, "debug"},
00621 {"skip", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_SKIP, INT_MIN, INT_MAX, V|D, "debug"},
00622 {"startcode", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_STARTCODE, INT_MIN, INT_MAX, V|D, "debug"},
00623 {"pts", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PTS, INT_MIN, INT_MAX, V|D, "debug"},
00624 {"er", "error resilience", 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"},
00625 {"mmco", "memory management control operations (H.264)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"},
00626 {"bugs", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"},
00627 {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"},
00628 {"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"},
00629 {"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"},
00630 {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
00631 {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
00632 {"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"},
00633 {"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00634 {"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00635 {"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00636 {"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00637 {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00638 {"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), FF_OPT_TYPE_INT, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
00639 {"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00640 {"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00641 {"preme", "pre motion estimation", OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00642 {"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00643 {"sad", "sum of absolute differences, fast (default)", 0, FF_OPT_TYPE_CONST, FF_CMP_SAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
00644 {"sse", "sum of squared errors", 0, FF_OPT_TYPE_CONST, FF_CMP_SSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
00645 {"satd", "sum of absolute Hadamard transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_SATD, INT_MIN, INT_MAX, V|E, "cmp_func"},
00646 {"dct", "sum of absolute DCT transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_DCT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00647 {"psnr", "sum of squared quantization errors (avoid, low quality)", 0, FF_OPT_TYPE_CONST, FF_CMP_PSNR, INT_MIN, INT_MAX, V|E, "cmp_func"},
00648 {"bit", "number of bits needed for the block", 0, FF_OPT_TYPE_CONST, FF_CMP_BIT, INT_MIN, INT_MAX, V|E, "cmp_func"},
00649 {"rd", "rate distortion optimal, slow", 0, FF_OPT_TYPE_CONST, FF_CMP_RD, INT_MIN, INT_MAX, V|E, "cmp_func"},
00650 {"zero", "0", 0, FF_OPT_TYPE_CONST, FF_CMP_ZERO, INT_MIN, INT_MAX, V|E, "cmp_func"},
00651 {"vsad", "sum of absolute vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
00652 {"vsse","sum of squared vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
00653 {"nsse", "noise preserving sum of squared differences", 0, FF_OPT_TYPE_CONST, FF_CMP_NSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
00654 #ifdef CONFIG_SNOW_ENCODER
00655 {"w53", "5/3 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W53, INT_MIN, INT_MAX, V|E, "cmp_func"},
00656 {"w97", "9/7 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W97, INT_MIN, INT_MAX, V|E, "cmp_func"},
00657 #endif
00658 {"dctmax", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"},
00659 {"chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_CHROMA, INT_MIN, INT_MAX, V|E, "cmp_func"},
00660 {"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00661 {"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E},
00662 {"dtg_active_format", NULL, OFFSET(dtg_active_format), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00663 {"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00664 {"ibias", "intra quant bias", OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E},
00665 {"pbias", "inter quant bias", OFFSET(inter_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E},
00666 {"color_table_id", NULL, OFFSET(color_table_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00667 {"internal_buffer_count", NULL, OFFSET(internal_buffer_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00668 {"global_quality", NULL, OFFSET(global_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00669 {"coder", NULL, OFFSET(coder_type), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "coder"},
00670 {"vlc", "variable length coder / huffman coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_VLC, INT_MIN, INT_MAX, V|E, "coder"},
00671 {"ac", "arithmetic coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_AC, INT_MIN, INT_MAX, V|E, "coder"},
00672 {"raw", "raw (no encoding)", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_RAW, INT_MIN, INT_MAX, V|E, "coder"},
00673 {"rle", "run-length coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_RLE, INT_MIN, INT_MAX, V|E, "coder"},
00674 {"deflate", "deflate-based coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_DEFLATE, INT_MIN, INT_MAX, V|E, "coder"},
00675 {"context", "context model", OFFSET(context_model), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00676 {"slice_flags", NULL, OFFSET(slice_flags), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00677 {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00678 {"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "mbd"},
00679 {"simple", "use mbcmp (default)", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_SIMPLE, INT_MIN, INT_MAX, V|E, "mbd"},
00680 {"bits", "use fewest bits", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_BITS, INT_MIN, INT_MAX, V|E, "mbd"},
00681 {"rd", "use best rate distortion", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_RD, INT_MIN, INT_MAX, V|E, "mbd"},
00682 {"stream_codec_tag", NULL, OFFSET(stream_codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00683 {"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00684 {"lmin", "min lagrange factor (VBR)", OFFSET(lmin), FF_OPT_TYPE_INT, 2*FF_QP2LAMBDA, 0, INT_MAX, V|E},
00685 {"lmax", "max lagrange factor (VBR)", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E},
00686 {"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00687 {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00688 {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00689 {"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|A|E|D, "flags2"},
00690 {"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00691 {"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"},
00692 {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"},
00693 {"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"},
00694 {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"},
00695 {"float", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FLOAT, INT_MIN, INT_MAX, V|D, "aa"},
00696 {"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00697 {"threads", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E|D},
00698 {"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
00699 {"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00700 {"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
00701 {"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E},
00702 {"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
00703 {"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
00704 {"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
00705 {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
00706 {"aac_main", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_MAIN, INT_MIN, INT_MAX, A|E, "profile"},
00707 {"aac_low", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LOW, INT_MIN, INT_MAX, A|E, "profile"},
00708 {"aac_ssr", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_SSR, INT_MIN, INT_MAX, A|E, "profile"},
00709 {"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LTP, INT_MIN, INT_MAX, A|E, "profile"},
00710 {"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
00711 {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
00712 {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D},
00713 {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00714 {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00715 {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00716 {"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), FF_OPT_TYPE_INT, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"},
00717 {"border_mask", "increases the quantizer for macroblocks close to borders", OFFSET(border_masking), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
00718 {"mblmin", "min macroblock lagrange factor (VBR)", OFFSET(mb_lmin), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 2, 1, FF_LAMBDA_MAX, V|E},
00719 {"mblmax", "max macroblock lagrange factor (VBR)", OFFSET(mb_lmax), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 31, 1, FF_LAMBDA_MAX, V|E},
00720 {"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, 256, INT_MIN, INT_MAX, V|E},
00721 {"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, DEFAULT, 0, 4, V|E},
00722 {"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E},
00723 {"crf", "enables constant quality mode, and selects the quality (x264)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E},
00724 {"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E},
00725 {"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, 25, INT_MIN, INT_MAX, V|E},
00726 {"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E},
00727 {"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00728 {"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
00729 {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E},
00730 {"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal)", OFFSET(directpred), FF_OPT_TYPE_INT, 2, INT_MIN, INT_MAX, V|E},
00731 {"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BPYRAMID, INT_MIN, INT_MAX, V|E, "flags2"},
00732 {"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_WPRED, INT_MIN, INT_MAX, V|E, "flags2"},
00733 {"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MIXED_REFS, INT_MIN, INT_MAX, V|E, "flags2"},
00734 {"dct8x8", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_8X8DCT, INT_MIN, INT_MAX, V|E, "flags2"},
00735 {"fastpskip", "fast pskip (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"},
00736 {"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"},
00737 {"brdo", "b-frame rate-distortion optimization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BRDO, INT_MIN, INT_MAX, V|E, "flags2"},
00738 {"skiprd", "RD optimal MB level residual skipping", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SKIP_RD, INT_MIN, INT_MAX, V|E, "flags2"},
00739 {"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN, FLT_MAX, V|E},
00740 {"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},
00741 {"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},
00742 {"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "partitions"},
00743 {"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I4X4, INT_MIN, INT_MAX, V|E, "partitions"},
00744 {"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I8X8, INT_MIN, INT_MAX, V|E, "partitions"},
00745 {"partp4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P4X4, INT_MIN, INT_MAX, V|E, "partitions"},
00746 {"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P8X8, INT_MIN, INT_MAX, V|E, "partitions"},
00747 {"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_B8X8, INT_MIN, INT_MAX, V|E, "partitions"},
00748 {"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E},
00749 {"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, 256, 0, INT_MAX, V|E},
00750 {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"},
00751 {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E},
00752 {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E},
00753 {"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00754 {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E},
00755 {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00756 {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00757 {"prediction_order_method", "search method for selecting prediction order", OFFSET(prediction_order_method), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00758 {"min_partition_order", NULL, OFFSET(min_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00759 {"max_partition_order", NULL, OFFSET(max_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
00760 {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E},
00761 {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
00762 {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
00763 {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
00764 {"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
00765 {NULL},
00766 };
00767
00768 #undef A
00769 #undef V
00770 #undef S
00771 #undef E
00772 #undef D
00773 #undef DEFAULT
00774
00775 static AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options };
00776
00777 void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){
00778 int flags=0;
00779 memset(s, 0, sizeof(AVCodecContext));
00780
00781 s->av_class= &av_codec_context_class;
00782
00783 s->codec_type = codec_type;
00784 if(codec_type == CODEC_TYPE_AUDIO)
00785 flags= AV_OPT_FLAG_AUDIO_PARAM;
00786 else if(codec_type == CODEC_TYPE_VIDEO)
00787 flags= AV_OPT_FLAG_VIDEO_PARAM;
00788 else if(codec_type == CODEC_TYPE_SUBTITLE)
00789 flags= AV_OPT_FLAG_SUBTITLE_PARAM;
00790 av_opt_set_defaults2(s, flags, flags);
00791
00792 s->rc_eq= "tex^qComp";
00793 s->time_base= (AVRational){0,1};
00794 s->get_buffer= avcodec_default_get_buffer;
00795 s->release_buffer= avcodec_default_release_buffer;
00796 s->get_format= avcodec_default_get_format;
00797 s->execute= avcodec_default_execute;
00798 s->sample_aspect_ratio= (AVRational){0,1};
00799 s->pix_fmt= PIX_FMT_NONE;
00800 s->sample_fmt= SAMPLE_FMT_S16;
00801
00802 s->palctrl = NULL;
00803 s->reget_buffer= avcodec_default_reget_buffer;
00804 }
00805
00806 AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
00807 AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
00808
00809 if(avctx==NULL) return NULL;
00810
00811 avcodec_get_context_defaults2(avctx, codec_type);
00812
00813 return avctx;
00814 }
00815
00816 void avcodec_get_context_defaults(AVCodecContext *s){
00817 avcodec_get_context_defaults2(s, CODEC_TYPE_UNKNOWN);
00818 }
00819
00820 AVCodecContext *avcodec_alloc_context(void){
00821 return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
00822 }
00823
00824 void avcodec_get_frame_defaults(AVFrame *pic){
00825 memset(pic, 0, sizeof(AVFrame));
00826
00827 pic->pts= AV_NOPTS_VALUE;
00828 pic->key_frame= 1;
00829 }
00830
00831 AVFrame *avcodec_alloc_frame(void){
00832 AVFrame *pic= av_malloc(sizeof(AVFrame));
00833
00834 if(pic==NULL) return NULL;
00835
00836 avcodec_get_frame_defaults(pic);
00837
00838 return pic;
00839 }
00840
00841 int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
00842 {
00843 int ret= -1;
00844
00845 entangled_thread_counter++;
00846 if(entangled_thread_counter != 1){
00847 av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
00848 goto end;
00849 }
00850
00851 if(avctx->codec || !codec)
00852 goto end;
00853
00854 if (codec->priv_data_size > 0) {
00855 avctx->priv_data = av_mallocz(codec->priv_data_size);
00856 if (!avctx->priv_data) {
00857 ret = AVERROR(ENOMEM);
00858 goto end;
00859 }
00860 } else {
00861 avctx->priv_data = NULL;
00862 }
00863
00864 if(avctx->coded_width && avctx->coded_height)
00865 avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
00866 else if(avctx->width && avctx->height)
00867 avcodec_set_dimensions(avctx, avctx->width, avctx->height);
00868
00869 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height)){
00870 av_freep(&avctx->priv_data);
00871 ret = AVERROR(EINVAL);
00872 goto end;
00873 }
00874
00875 avctx->codec = codec;
00876 avctx->codec_id = codec->id;
00877 avctx->frame_number = 0;
00878 if(avctx->codec->init){
00879 ret = avctx->codec->init(avctx);
00880 if (ret < 0) {
00881 av_freep(&avctx->priv_data);
00882 avctx->codec= NULL;
00883 goto end;
00884 }
00885 }
00886 ret=0;
00887 end:
00888 entangled_thread_counter--;
00889 return ret;
00890 }
00891
00892 int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
00893 const short *samples)
00894 {
00895 if(buf_size < FF_MIN_BUFFER_SIZE && 0){
00896 av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
00897 return -1;
00898 }
00899 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
00900 int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
00901 avctx->frame_number++;
00902 return ret;
00903 }else
00904 return 0;
00905 }
00906
00907 int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
00908 const AVFrame *pict)
00909 {
00910 if(buf_size < FF_MIN_BUFFER_SIZE){
00911 av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
00912 return -1;
00913 }
00914 if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
00915 return -1;
00916 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
00917 int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
00918 avctx->frame_number++;
00919 emms_c();
00920
00921 return ret;
00922 }else
00923 return 0;
00924 }
00925
00926 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
00927 const AVSubtitle *sub)
00928 {
00929 int ret;
00930 ret = avctx->codec->encode(avctx, buf, buf_size, (void *)sub);
00931 avctx->frame_number++;
00932 return ret;
00933 }
00934
00935 int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
00936 int *got_picture_ptr,
00937 const uint8_t *buf, int buf_size)
00938 {
00939 int ret;
00940
00941 *got_picture_ptr= 0;
00942 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
00943 return -1;
00944 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
00945 ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
00946 buf, buf_size);
00947
00948 emms_c();
00949
00950 if (*got_picture_ptr)
00951 avctx->frame_number++;
00952 }else
00953 ret= 0;
00954
00955 return ret;
00956 }
00957
00958 int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
00959 int *frame_size_ptr,
00960 const uint8_t *buf, int buf_size)
00961 {
00962 int ret;
00963
00964 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
00965
00966 if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
00967 av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
00968 return -1;
00969 }
00970 if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||
00971 *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t)){
00972 av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
00973 return -1;
00974 }
00975
00976 ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
00977 buf, buf_size);
00978 avctx->frame_number++;
00979 }else{
00980 ret= 0;
00981 *frame_size_ptr=0;
00982 }
00983 return ret;
00984 }
00985
00986 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
00987 int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
00988 int *frame_size_ptr,
00989 const uint8_t *buf, int buf_size){
00990 *frame_size_ptr= AVCODEC_MAX_AUDIO_FRAME_SIZE;
00991 return avcodec_decode_audio2(avctx, samples, frame_size_ptr, buf, buf_size);
00992 }
00993 #endif
00994
00995 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
00996 int *got_sub_ptr,
00997 const uint8_t *buf, int buf_size)
00998 {
00999 int ret;
01000
01001 *got_sub_ptr = 0;
01002 ret = avctx->codec->decode(avctx, sub, got_sub_ptr,
01003 buf, buf_size);
01004 if (*got_sub_ptr)
01005 avctx->frame_number++;
01006 return ret;
01007 }
01008
01009 int avcodec_close(AVCodecContext *avctx)
01010 {
01011 entangled_thread_counter++;
01012 if(entangled_thread_counter != 1){
01013 av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
01014 entangled_thread_counter--;
01015 return -1;
01016 }
01017
01018 if (ENABLE_THREADS && avctx->thread_opaque)
01019 avcodec_thread_free(avctx);
01020 if (avctx->codec->close)
01021 avctx->codec->close(avctx);
01022 avcodec_default_free_buffers(avctx);
01023 av_freep(&avctx->priv_data);
01024 avctx->codec = NULL;
01025 entangled_thread_counter--;
01026 return 0;
01027 }
01028
01029 AVCodec *avcodec_find_encoder(enum CodecID id)
01030 {
01031 AVCodec *p;
01032 p = first_avcodec;
01033 while (p) {
01034 if (p->encode != NULL && p->id == id)
01035 return p;
01036 p = p->next;
01037 }
01038 return NULL;
01039 }
01040
01041 AVCodec *avcodec_find_encoder_by_name(const char *name)
01042 {
01043 AVCodec *p;
01044 p = first_avcodec;
01045 while (p) {
01046 if (p->encode != NULL && strcmp(name,p->name) == 0)
01047 return p;
01048 p = p->next;
01049 }
01050 return NULL;
01051 }
01052
01053 AVCodec *avcodec_find_decoder(enum CodecID id)
01054 {
01055 AVCodec *p;
01056 p = first_avcodec;
01057 while (p) {
01058 if (p->decode != NULL && p->id == id)
01059 return p;
01060 p = p->next;
01061 }
01062 return NULL;
01063 }
01064
01065 AVCodec *avcodec_find_decoder_by_name(const char *name)
01066 {
01067 AVCodec *p;
01068 p = first_avcodec;
01069 while (p) {
01070 if (p->decode != NULL && strcmp(name,p->name) == 0)
01071 return p;
01072 p = p->next;
01073 }
01074 return NULL;
01075 }
01076
01077 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
01078 {
01079 const char *codec_name;
01080 AVCodec *p;
01081 char buf1[32];
01082 char channels_str[100];
01083 int bitrate;
01084 AVRational display_aspect_ratio;
01085
01086 if (encode)
01087 p = avcodec_find_encoder(enc->codec_id);
01088 else
01089 p = avcodec_find_decoder(enc->codec_id);
01090
01091 if (p) {
01092 codec_name = p->name;
01093 if (!encode && enc->codec_id == CODEC_ID_MP3) {
01094 if (enc->sub_id == 2)
01095 codec_name = "mp2";
01096 else if (enc->sub_id == 1)
01097 codec_name = "mp1";
01098 }
01099 } else if (enc->codec_id == CODEC_ID_MPEG2TS) {
01100
01101
01102 codec_name = "mpeg2ts";
01103 } else if (enc->codec_name[0] != '\0') {
01104 codec_name = enc->codec_name;
01105 } else {
01106
01107 if( isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF)
01108 && isprint((enc->codec_tag>>16)&0xFF) && isprint((enc->codec_tag>>24)&0xFF)){
01109 snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X",
01110 enc->codec_tag & 0xff,
01111 (enc->codec_tag >> 8) & 0xff,
01112 (enc->codec_tag >> 16) & 0xff,
01113 (enc->codec_tag >> 24) & 0xff,
01114 enc->codec_tag);
01115 } else {
01116 snprintf(buf1, sizeof(buf1), "0x%04x", enc->codec_tag);
01117 }
01118 codec_name = buf1;
01119 }
01120
01121 switch(enc->codec_type) {
01122 case CODEC_TYPE_VIDEO:
01123 snprintf(buf, buf_size,
01124 "Video: %s%s",
01125 codec_name, enc->mb_decision ? " (hq)" : "");
01126 if (enc->pix_fmt != PIX_FMT_NONE) {
01127 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01128 ", %s",
01129 avcodec_get_pix_fmt_name(enc->pix_fmt));
01130 }
01131 if (enc->width) {
01132 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01133 ", %dx%d",
01134 enc->width, enc->height);
01135 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
01136 enc->width*enc->sample_aspect_ratio.num,
01137 enc->height*enc->sample_aspect_ratio.den,
01138 1024*1024);
01139 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01140 " [PAR %d:%d DAR %d:%d]",
01141 enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den,
01142 display_aspect_ratio.num, display_aspect_ratio.den);
01143 if(av_log_get_level() >= AV_LOG_DEBUG){
01144 int g= ff_gcd(enc->time_base.num, enc->time_base.den);
01145 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01146 ", %d/%d",
01147 enc->time_base.num/g, enc->time_base.den/g);
01148 }
01149 }
01150 if (encode) {
01151 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01152 ", q=%d-%d", enc->qmin, enc->qmax);
01153 }
01154 bitrate = enc->bit_rate;
01155 break;
01156 case CODEC_TYPE_AUDIO:
01157 snprintf(buf, buf_size,
01158 "Audio: %s",
01159 codec_name);
01160 switch (enc->channels) {
01161 case 1:
01162 strcpy(channels_str, "mono");
01163 break;
01164 case 2:
01165 strcpy(channels_str, "stereo");
01166 break;
01167 case 6:
01168 strcpy(channels_str, "5:1");
01169 break;
01170 default:
01171 snprintf(channels_str, sizeof(channels_str), "%d channels", enc->channels);
01172 break;
01173 }
01174 if (enc->sample_rate) {
01175 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01176 ", %d Hz, %s",
01177 enc->sample_rate,
01178 channels_str);
01179 }
01180
01181
01182 switch(enc->codec_id) {
01183 case CODEC_ID_PCM_S32LE:
01184 case CODEC_ID_PCM_S32BE:
01185 case CODEC_ID_PCM_U32LE:
01186 case CODEC_ID_PCM_U32BE:
01187 bitrate = enc->sample_rate * enc->channels * 32;
01188 break;
01189 case CODEC_ID_PCM_S24LE:
01190 case CODEC_ID_PCM_S24BE:
01191 case CODEC_ID_PCM_U24LE:
01192 case CODEC_ID_PCM_U24BE:
01193 case CODEC_ID_PCM_S24DAUD:
01194 bitrate = enc->sample_rate * enc->channels * 24;
01195 break;
01196 case CODEC_ID_PCM_S16LE:
01197 case CODEC_ID_PCM_S16BE:
01198 case CODEC_ID_PCM_S16LE_PLANAR:
01199 case CODEC_ID_PCM_U16LE:
01200 case CODEC_ID_PCM_U16BE:
01201 bitrate = enc->sample_rate * enc->channels * 16;
01202 break;
01203 case CODEC_ID_PCM_S8:
01204 case CODEC_ID_PCM_U8:
01205 case CODEC_ID_PCM_ALAW:
01206 case CODEC_ID_PCM_MULAW:
01207 bitrate = enc->sample_rate * enc->channels * 8;
01208 break;
01209 default:
01210 bitrate = enc->bit_rate;
01211 break;
01212 }
01213 break;
01214 case CODEC_TYPE_DATA:
01215 snprintf(buf, buf_size, "Data: %s", codec_name);
01216 bitrate = enc->bit_rate;
01217 break;
01218 case CODEC_TYPE_SUBTITLE:
01219 snprintf(buf, buf_size, "Subtitle: %s", codec_name);
01220 bitrate = enc->bit_rate;
01221 break;
01222 case CODEC_TYPE_ATTACHMENT:
01223 snprintf(buf, buf_size, "Attachment: %s", codec_name);
01224 bitrate = enc->bit_rate;
01225 break;
01226 default:
01227 snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type);
01228 return;
01229 }
01230 if (encode) {
01231 if (enc->flags & CODEC_FLAG_PASS1)
01232 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01233 ", pass 1");
01234 if (enc->flags & CODEC_FLAG_PASS2)
01235 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01236 ", pass 2");
01237 }
01238 if (bitrate != 0) {
01239 snprintf(buf + strlen(buf), buf_size - strlen(buf),
01240 ", %d kb/s", bitrate / 1000);
01241 }
01242 }
01243
01244 unsigned avcodec_version( void )
01245 {
01246 return LIBAVCODEC_VERSION_INT;
01247 }
01248
01249 unsigned avcodec_build( void )
01250 {
01251 return LIBAVCODEC_BUILD;
01252 }
01253
01254 void avcodec_init(void)
01255 {
01256 static int inited = 0;
01257
01258 if (inited != 0)
01259 return;
01260 inited = 1;
01261
01262 dsputil_static_init();
01263 }
01264
01265 void avcodec_flush_buffers(AVCodecContext *avctx)
01266 {
01267 if(avctx->codec->flush)
01268 avctx->codec->flush(avctx);
01269 }
01270
01271 void avcodec_default_free_buffers(AVCodecContext *s){
01272 int i, j;
01273
01274 if(s->internal_buffer==NULL) return;
01275
01276 for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
01277 InternalBuffer *buf= &((InternalBuffer*)s->internal_buffer)[i];
01278 for(j=0; j<4; j++){
01279 av_freep(&buf->base[j]);
01280 buf->data[j]= NULL;
01281 }
01282 }
01283 av_freep(&s->internal_buffer);
01284
01285 s->internal_buffer_count=0;
01286 }
01287
01288 char av_get_pict_type_char(int pict_type){
01289 switch(pict_type){
01290 case I_TYPE: return 'I';
01291 case P_TYPE: return 'P';
01292 case B_TYPE: return 'B';
01293 case S_TYPE: return 'S';
01294 case SI_TYPE:return 'i';
01295 case SP_TYPE:return 'p';
01296 default: return '?';
01297 }
01298 }
01299
01300 int av_get_bits_per_sample(enum CodecID codec_id){
01301 switch(codec_id){
01302 case CODEC_ID_ADPCM_SBPRO_2:
01303 return 2;
01304 case CODEC_ID_ADPCM_SBPRO_3:
01305 return 3;
01306 case CODEC_ID_ADPCM_SBPRO_4:
01307 case CODEC_ID_ADPCM_CT:
01308 return 4;
01309 case CODEC_ID_PCM_ALAW:
01310 case CODEC_ID_PCM_MULAW:
01311 case CODEC_ID_PCM_S8:
01312 case CODEC_ID_PCM_U8:
01313 return 8;
01314 case CODEC_ID_PCM_S16BE:
01315 case CODEC_ID_PCM_S16LE:
01316 case CODEC_ID_PCM_S16LE_PLANAR:
01317 case CODEC_ID_PCM_U16BE:
01318 case CODEC_ID_PCM_U16LE:
01319 return 16;
01320 case CODEC_ID_PCM_S24DAUD:
01321 case CODEC_ID_PCM_S24BE:
01322 case CODEC_ID_PCM_S24LE:
01323 case CODEC_ID_PCM_U24BE:
01324 case CODEC_ID_PCM_U24LE:
01325 return 24;
01326 case CODEC_ID_PCM_S32BE:
01327 case CODEC_ID_PCM_S32LE:
01328 case CODEC_ID_PCM_U32BE:
01329 case CODEC_ID_PCM_U32LE:
01330 return 32;
01331 default:
01332 return 0;
01333 }
01334 }
01335
01336 int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
01337 switch (sample_fmt) {
01338 case SAMPLE_FMT_U8:
01339 return 8;
01340 case SAMPLE_FMT_S16:
01341 return 16;
01342 case SAMPLE_FMT_S24:
01343 return 24;
01344 case SAMPLE_FMT_S32:
01345 case SAMPLE_FMT_FLT:
01346 return 32;
01347 default:
01348 return 0;
01349 }
01350 }
01351
01352 #if !defined(HAVE_THREADS)
01353 int avcodec_thread_init(AVCodecContext *s, int thread_count){
01354 return -1;
01355 }
01356 #endif
01357
01358 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
01359 {
01360 unsigned int n = 0;
01361
01362 while(v >= 0xff) {
01363 *s++ = 0xff;
01364 v -= 0xff;
01365 n++;
01366 }
01367 *s = v;
01368 n++;
01369 return n;
01370 }
01371
01372
01373
01374
01375
01376
01377 int av_tempfile(char *prefix, char **filename) {
01378 int fd=-1;
01379 #if !defined(HAVE_MKSTEMP)
01380 *filename = tempnam(".", prefix);
01381 #else
01382 size_t len = strlen(prefix) + 12;
01383 *filename = av_malloc(len);
01384 #endif
01385
01386 if (*filename == NULL) {
01387 av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
01388 return -1;
01389 }
01390 #if !defined(HAVE_MKSTEMP)
01391 fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
01392 #else
01393 snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
01394 fd = mkstemp(*filename);
01395 if (fd < 0) {
01396 snprintf(*filename, len, "./%sXXXXXX", prefix);
01397 fd = mkstemp(*filename);
01398 }
01399 #endif
01400
01401 if (fd < 0) {
01402 av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
01403 return -1;
01404 }
01405 return fd;
01406 }
01407
01408 typedef struct {
01409 const char *abbr;
01410 int width, height;
01411 } VideoFrameSizeAbbr;
01412
01413 typedef struct {
01414 const char *abbr;
01415 int rate_num, rate_den;
01416 } VideoFrameRateAbbr;
01417
01418 static VideoFrameSizeAbbr video_frame_size_abbrs[] = {
01419 { "ntsc", 720, 480 },
01420 { "pal", 720, 576 },
01421 { "qntsc", 352, 240 },
01422 { "qpal", 352, 288 },
01423 { "sntsc", 640, 480 },
01424 { "spal", 768, 576 },
01425 { "film", 352, 240 },
01426 { "ntsc-film", 352, 240 },
01427 { "sqcif", 128, 96 },
01428 { "qcif", 176, 144 },
01429 { "cif", 352, 288 },
01430 { "4cif", 704, 576 },
01431 { "qqvga", 160, 120 },
01432 { "qvga", 320, 240 },
01433 { "vga", 640, 480 },
01434 { "svga", 800, 600 },
01435 { "xga", 1024, 768 },
01436 { "uxga", 1600,1200 },
01437 { "qxga", 2048,1536 },
01438 { "sxga", 1280,1024 },
01439 { "qsxga", 2560,2048 },
01440 { "hsxga", 5120,4096 },
01441 { "wvga", 852, 480 },
01442 { "wxga", 1366, 768 },
01443 { "wsxga", 1600,1024 },
01444 { "wuxga", 1920,1200 },
01445 { "woxga", 2560,1600 },
01446 { "wqsxga", 3200,2048 },
01447 { "wquxga", 3840,2400 },
01448 { "whsxga", 6400,4096 },
01449 { "whuxga", 7680,4800 },
01450 { "cga", 320, 200 },
01451 { "ega", 640, 350 },
01452 { "hd480", 852, 480 },
01453 { "hd720", 1280, 720 },
01454 { "hd1080", 1920,1080 },
01455 };
01456
01457 static VideoFrameRateAbbr video_frame_rate_abbrs[]= {
01458 { "ntsc", 30000, 1001 },
01459 { "pal", 25, 1 },
01460 { "qntsc", 30000, 1001 },
01461 { "qpal", 25, 1 },
01462 { "sntsc", 30000, 1001 },
01463 { "spal", 25, 1 },
01464 { "film", 24, 1 },
01465 { "ntsc-film", 24000, 1001 },
01466 };
01467
01468 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
01469 {
01470 int i;
01471 int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr);
01472 const char *p;
01473 int frame_width = 0, frame_height = 0;
01474
01475 for(i=0;i<n;i++) {
01476 if (!strcmp(video_frame_size_abbrs[i].abbr, str)) {
01477 frame_width = video_frame_size_abbrs[i].width;
01478 frame_height = video_frame_size_abbrs[i].height;
01479 break;
01480 }
01481 }
01482 if (i == n) {
01483 p = str;
01484 frame_width = strtol(p, (char **)&p, 10);
01485 if (*p)
01486 p++;
01487 frame_height = strtol(p, (char **)&p, 10);
01488 }
01489 if (frame_width <= 0 || frame_height <= 0)
01490 return -1;
01491 *width_ptr = frame_width;
01492 *height_ptr = frame_height;
01493 return 0;
01494 }
01495
01496 int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
01497 {
01498 int i;
01499 int n = sizeof(video_frame_rate_abbrs) / sizeof(VideoFrameRateAbbr);
01500 char* cp;
01501
01502
01503 for (i = 0; i < n; ++i)
01504 if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
01505 frame_rate->num = video_frame_rate_abbrs[i].rate_num;
01506 frame_rate->den = video_frame_rate_abbrs[i].rate_den;
01507 return 0;
01508 }
01509
01510
01511 cp = strchr(arg, '/');
01512 if (!cp)
01513 cp = strchr(arg, ':');
01514 if (cp) {
01515 char* cpp;
01516 frame_rate->num = strtol(arg, &cpp, 10);
01517 if (cpp != arg || cpp == cp)
01518 frame_rate->den = strtol(cp+1, &cpp, 10);
01519 else
01520 frame_rate->num = 0;
01521 }
01522 else {
01523
01524 AVRational time_base = av_d2q(strtod(arg, 0), DEFAULT_FRAME_RATE_BASE);
01525 frame_rate->den = time_base.den;
01526 frame_rate->num = time_base.num;
01527 }
01528 if (!frame_rate->num || !frame_rate->den)
01529 return -1;
01530 else
01531 return 0;
01532 }