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