patch by Peter Robinson pbrobinson @ at @ gmail . dot . com and myself Originally committed as revision 4382 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -298,7 +298,7 @@ extern int motion_estimation_method; | |||
| /* encoding support | |||
| these flags can be passed in AVCodecContext.flags before initing | |||
| Note: note not everything is supported yet | |||
| Note: not everything is supported yet. | |||
| */ | |||
| #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale | |||
| @@ -314,7 +314,7 @@ extern int motion_estimation_method; | |||
| #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode | |||
| #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) | |||
| #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale | |||
| #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges | |||
| #define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges | |||
| #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding | |||
| #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead | |||
| of only at frame boundaries */ | |||
| @@ -367,7 +367,7 @@ extern int motion_estimation_method; | |||
| */ | |||
| #define CODEC_CAP_DELAY 0x0020 | |||
| //the following defines might change, so dont expect compatibility if u use them | |||
| //the following defines may change, don't expect compatibility if you use them | |||
| #define MB_TYPE_INTRA4x4 0x0001 | |||
| #define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific | |||
| #define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific | |||
| @@ -430,7 +430,7 @@ typedef struct AVPanScan{ | |||
| int linesize[4];\ | |||
| /**\ | |||
| * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\ | |||
| * this isnt used by lavc unless the default get/release_buffer() is used\ | |||
| * this isn't used by lavc unless the default get/release_buffer() is used\ | |||
| * - encoding: \ | |||
| * - decoding: \ | |||
| */\ | |||
| @@ -632,8 +632,8 @@ typedef struct AVPanScan{ | |||
| #define FF_BUFFER_TYPE_INTERNAL 1 | |||
| #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user) | |||
| #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc image (data/base), all other tables are not shared | |||
| #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, dont dealloc anything | |||
| #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared | |||
| #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, don't dealloc anything | |||
| #define FF_I_TYPE 1 // Intra | |||
| @@ -866,7 +866,7 @@ typedef struct AVCodecContext { | |||
| /* unused, FIXME remove*/ | |||
| int rtp_mode; | |||
| int rtp_payload_size; /* The size of the RTP payload, the coder will */ | |||
| int rtp_payload_size; /* The size of the RTP payload: the coder will */ | |||
| /* do it's best to deliver a chunk with size */ | |||
| /* below rtp_payload_size, the chunk will start */ | |||
| /* with a start code on some codecs like H.263 */ | |||
| @@ -874,12 +874,12 @@ typedef struct AVCodecContext { | |||
| /* headers inside the transmited RTP payload */ | |||
| /* The RTP callcack: This function is called */ | |||
| /* every time the encoder as a packet to send */ | |||
| /* Depends on the encoder if the data starts */ | |||
| /* with a Start Code (it should) H.263 does. */ | |||
| /* mb_nb contains the number of macroblocks */ | |||
| /* encoded in the RTP payload */ | |||
| /* The RTP callback: This function is called */ | |||
| /* every time the encoder has a packet to send */ | |||
| /* Depends on the encoder if the data starts */ | |||
| /* with a Start Code (it should) H.263 does. */ | |||
| /* mb_nb contains the number of macroblocks */ | |||
| /* encoded in the RTP payload */ | |||
| void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); | |||
| /* statistics, used for 2-pass encoding */ | |||
| @@ -1458,13 +1458,13 @@ typedef struct AVCodecContext { | |||
| /** | |||
| * internal_buffer count. | |||
| * Dont touch, used by lavc default_get_buffer() | |||
| * Don't touch, used by lavc default_get_buffer() | |||
| */ | |||
| int internal_buffer_count; | |||
| /** | |||
| * internal_buffers. | |||
| * Dont touch, used by lavc default_get_buffer() | |||
| * Don't touch, used by lavc default_get_buffer() | |||
| */ | |||
| void *internal_buffer; | |||
| @@ -2265,13 +2265,13 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) | |||
| /** | |||
| * rescale a 64bit integer with rounding to nearest. | |||
| * a simple a*b/c isnt possible as it can overflow | |||
| * a simple a*b/c isn't possible as it can overflow | |||
| */ | |||
| int64_t av_rescale(int64_t a, int64_t b, int64_t c); | |||
| /** | |||
| * rescale a 64bit integer with specified rounding. | |||
| * a simple a*b/c isnt possible as it can overflow | |||
| * a simple a*b/c isn't possible as it can overflow | |||
| */ | |||
| int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding); | |||
| @@ -334,14 +334,14 @@ GET_CACHE(name, gb) | |||
| will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit) | |||
| SHOW_UBITS(name, gb, num) | |||
| will return the nest num bits | |||
| will return the next num bits | |||
| SHOW_SBITS(name, gb, num) | |||
| will return the nest num bits and do sign extension | |||
| will return the next num bits and do sign extension | |||
| SKIP_BITS(name, gb, num) | |||
| will skip over the next num bits | |||
| note, this is equinvalent to SKIP_CACHE; SKIP_COUNTER | |||
| note, this is equivalent to SKIP_CACHE; SKIP_COUNTER | |||
| SKIP_CACHE(name, gb, num) | |||
| will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER) | |||
| @@ -353,7 +353,7 @@ LAST_SKIP_CACHE(name, gb, num) | |||
| will remove the next num bits from the cache if it is needed for UPDATE_CACHE otherwise it will do nothing | |||
| LAST_SKIP_BITS(name, gb, num) | |||
| is equinvalent to SKIP_LAST_CACHE; SKIP_COUNTER | |||
| is equivalent to SKIP_LAST_CACHE; SKIP_COUNTER | |||
| for examples see get_bits, show_bits, skip_bits, get_vlc | |||
| */ | |||
| @@ -598,7 +598,7 @@ static inline int get_sbits(GetBitContext *s, int n){ | |||
| /** | |||
| * reads 0-17 bits. | |||
| * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant | |||
| * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't | |||
| */ | |||
| static inline unsigned int get_bits(GetBitContext *s, int n){ | |||
| register int tmp; | |||
| @@ -614,7 +614,7 @@ unsigned int get_bits_long(GetBitContext *s, int n); | |||
| /** | |||
| * shows 0-17 bits. | |||
| * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant | |||
| * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't | |||
| */ | |||
| static inline unsigned int show_bits(GetBitContext *s, int n){ | |||
| register int tmp; | |||
| @@ -245,10 +245,10 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) | |||
| /* By now UMV IS DISABLED ON H.263v1, since the restrictions | |||
| of H.263v1 UMV implies to check the predicted MV after | |||
| calculation of the current MB to see if we're on the limits */ | |||
| put_bits(&s->pb, 1, 0); /* unrestricted motion vector: off */ | |||
| put_bits(&s->pb, 1, 0); /* Unrestricted Motion Vector: off */ | |||
| put_bits(&s->pb, 1, 0); /* SAC: off */ | |||
| put_bits(&s->pb, 1, s->obmc); /* advanced prediction mode */ | |||
| put_bits(&s->pb, 1, 0); /* not PB frame */ | |||
| put_bits(&s->pb, 1, s->obmc); /* Advanced Prediction */ | |||
| put_bits(&s->pb, 1, 0); /* only I/P frames, no PB frame */ | |||
| put_bits(&s->pb, 5, s->qscale); | |||
| put_bits(&s->pb, 1, 0); /* Continuous Presence Multipoint mode: off */ | |||
| } else { | |||
| @@ -122,7 +122,7 @@ int ff_h263_decode_end(AVCodecContext *avctx) | |||
| } | |||
| /** | |||
| * retunrs the number of bytes consumed for building the current frame | |||
| * returns the number of bytes consumed for building the current frame | |||
| */ | |||
| static int get_consumed_bytes(MpegEncContext *s, int buf_size){ | |||
| int pos= (get_bits_count(&s->gb)+7)>>3; | |||
| @@ -279,7 +279,7 @@ static int decode_slice(MpegEncContext *s){ | |||
| s->workaround_bugs &= ~FF_BUG_NO_PADDING; | |||
| } | |||
| // handle formats which dont have unique end markers | |||
| // handle formats which don't have unique end markers | |||
| if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly | |||
| int left= s->gb.size_in_bits - get_bits_count(&s->gb); | |||
| int max_extra=7; | |||
| @@ -669,7 +669,7 @@ retry: | |||
| s->current_picture.pict_type= s->pict_type; | |||
| s->current_picture.key_frame= s->pict_type == I_TYPE; | |||
| /* skip b frames if we dont have reference frames */ | |||
| /* skip B-frames if we don't have reference frames */ | |||
| if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size); | |||
| /* skip b frames if we are in a hurry */ | |||
| if(avctx->hurry_up && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size); | |||
| @@ -772,7 +772,7 @@ assert(s->current_picture.pict_type == s->pict_type); | |||
| /* we substract 1 because it is added on utils.c */ | |||
| avctx->frame_number = s->picture_number - 1; | |||
| /* dont output the last pic after seeking */ | |||
| /* don't output the last pic after seeking */ | |||
| if(s->last_picture_ptr || s->low_delay) | |||
| *data_size = sizeof(AVFrame); | |||
| #ifdef PRINT_FRAME_TIME | |||
| @@ -664,7 +664,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) | |||
| s->p_mv_table[xy][0] = mx; | |||
| s->p_mv_table[xy][1] = my; | |||
| /* has allready been set to the 4 MV if 4MV is done */ | |||
| /* has already been set to the 4 MV if 4MV is done */ | |||
| if(mv4){ | |||
| int mot_xy= s->block_index[0]; | |||
| @@ -364,7 +364,7 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){ | |||
| } | |||
| if(pic->linesize[1] != pic->linesize[2]){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride missmatch)\n"); | |||
| av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n"); | |||
| return -1; | |||
| } | |||
| @@ -542,9 +542,9 @@ static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContex | |||
| COPY(lambda2); | |||
| COPY(picture_in_gop_number); | |||
| COPY(gop_picture_number); | |||
| COPY(frame_pred_frame_dct); //FIXME dont set in encode_header | |||
| COPY(progressive_frame); //FIXME dont set in encode_header | |||
| COPY(partitioned_frame); //FIXME dont set in encode_header | |||
| COPY(frame_pred_frame_dct); //FIXME don't set in encode_header | |||
| COPY(progressive_frame); //FIXME don't set in encode_header | |||
| COPY(partitioned_frame); //FIXME don't set in encode_header | |||
| #undef COPY | |||
| } | |||
| @@ -1475,7 +1475,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) | |||
| } | |||
| alloc: | |||
| if(!s->encoding){ | |||
| /* release non refernce frames */ | |||
| /* release non reference frames */ | |||
| for(i=0; i<MAX_PICTURE_COUNT; i++){ | |||
| if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){ | |||
| s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]); | |||
| @@ -1526,7 +1526,7 @@ alloc: | |||
| if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){ | |||
| av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); | |||
| assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference | |||
| assert(s->pict_type != B_TYPE); //these should have been dropped if we don't have a reference | |||
| goto alloc; | |||
| } | |||
| @@ -1548,8 +1548,8 @@ alloc: | |||
| s->hurry_up= s->avctx->hurry_up; | |||
| s->error_resilience= avctx->error_resilience; | |||
| /* set dequantizer, we cant do it during init as it might change for mpeg4 | |||
| and we cant do it in the header decode as init isnt called for mpeg4 there yet */ | |||
| /* set dequantizer, we can't do it during init as it might change for mpeg4 | |||
| and we can't do it in the header decode as init isnt called for mpeg4 there yet */ | |||
| if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){ | |||
| s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; | |||
| s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; | |||
| @@ -1608,7 +1608,7 @@ void MPV_frame_end(MpegEncContext *s) | |||
| #endif | |||
| if(s->encoding){ | |||
| /* release non refernce frames */ | |||
| /* release non-reference frames */ | |||
| for(i=0; i<MAX_PICTURE_COUNT; i++){ | |||
| if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){ | |||
| s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]); | |||
| @@ -2146,7 +2146,7 @@ static void select_input_picture(MpegEncContext *s){ | |||
| s->reordered_input_picture[i-1]= s->reordered_input_picture[i]; | |||
| s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL; | |||
| /* set next picture types & ordering */ | |||
| /* set next picture type & ordering */ | |||
| if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){ | |||
| if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){ | |||
| s->reordered_input_picture[0]= s->input_picture[0]; | |||
| @@ -2263,7 +2263,7 @@ no_output_pic: | |||
| copy_picture(&s->new_picture, s->reordered_input_picture[0]); | |||
| if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ | |||
| // input is a shared pix, so we cant modifiy it -> alloc a new one & ensure that the shared one is reuseable | |||
| // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable | |||
| int i= ff_find_unused_picture(s, 0); | |||
| Picture *pic= &s->picture[i]; | |||
| @@ -3210,7 +3210,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, | |||
| } | |||
| /** | |||
| * motion compesation of a single macroblock | |||
| * motion compensation of a single macroblock | |||
| * @param s context | |||
| * @param dest_y luma destination pointer | |||
| * @param dest_cb chroma cb/u destination pointer | |||
| @@ -3459,7 +3459,7 @@ static inline void MPV_motion(MpegEncContext *s, | |||
| } | |||
| /** | |||
| * motion compesation of a single macroblock | |||
| * motion compensation of a single macroblock | |||
| * @param s context | |||
| * @param dest_y luma destination pointer | |||
| * @param dest_cb chroma cb/u destination pointer | |||
| @@ -4004,7 +4004,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ | |||
| } | |||
| void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename | |||
| const int linesize= s->current_picture.linesize[0]; //not s->linesize as this woulnd be wrong for field pics | |||
| const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics | |||
| const int uvlinesize= s->current_picture.linesize[1]; | |||
| const int mb_size= 4 - s->avctx->lowres; | |||
| @@ -181,7 +181,7 @@ typedef struct Picture{ | |||
| uint16_t *mb_var; ///< Table for MB variances | |||
| uint16_t *mc_mb_var; ///< Table for motion compensated MB variances | |||
| uint8_t *mb_mean; ///< Table for MB luminance | |||
| int32_t *mb_cmp_score; ///< Table for MB cmp scores, for mb decission FIXME remove | |||
| int32_t *mb_cmp_score; ///< Table for MB cmp scores, for mb decision FIXME remove | |||
| int b_frame_score; /* */ | |||
| } Picture; | |||
| @@ -292,10 +292,10 @@ typedef struct MpegEncContext { | |||
| int b_frames_since_non_b; ///< used for encoding, relative to not yet reordered input | |||
| int64_t user_specified_pts;///< last non zero pts from AVFrame which was passed into avcodec_encode_video() | |||
| int mb_width, mb_height; ///< number of MBs horizontally & vertically | |||
| int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressng of left & top MBs withoutt sig11 | |||
| int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressng | |||
| int b4_stride; ///< 4*mb_width+1 used for some 4x4 block arrays to allow simple addressng | |||
| int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replicateion) | |||
| int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 | |||
| int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing | |||
| int b4_stride; ///< 4*mb_width+1 used for some 4x4 block arrays to allow simple addressing | |||
| int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication) | |||
| int mb_num; ///< number of MBs of a picture | |||
| int linesize; ///< line size, in bytes, may be different from width | |||
| int uvlinesize; ///< line size, for chroma in bytes, may be different from width | |||
| @@ -358,7 +358,7 @@ typedef struct MpegEncContext { | |||
| uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding | |||
| uint8_t *allocated_edge_emu_buffer; | |||
| uint8_t *edge_emu_buffer; ///< points into the middle of allocated_edge_emu_buffer | |||
| uint8_t *rd_scratchpad; ///< scartchpad for rate distortion mb decission | |||
| uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision | |||
| uint8_t *obmc_scratchpad; | |||
| uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers | |||
| @@ -380,7 +380,7 @@ typedef struct MpegEncContext { | |||
| int h263_long_vectors; ///< use horrible h263v1 long vector mode | |||
| int decode; ///< if 0 then decoding will be skipped (for encoding b frames for example) | |||
| DSPContext dsp; ///< pointers for accelerated dsp fucntions | |||
| DSPContext dsp; ///< pointers for accelerated dsp functions | |||
| int f_code; ///< forward MV resolution | |||
| int b_code; ///< backward MV resolution for B Frames (mpeg4) | |||
| int16_t (*p_mv_table_base)[2]; | |||
| @@ -583,7 +583,7 @@ int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){ | |||
| int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict); | |||
| avctx->frame_number++; | |||
| emms_c(); //needed to avoid a emms_c() call before every return; | |||
| emms_c(); //needed to avoid an emms_c() call before every return; | |||
| return ret; | |||
| }else | |||
| @@ -621,7 +621,7 @@ int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | |||
| ret = avctx->codec->decode(avctx, picture, got_picture_ptr, | |||
| buf, buf_size); | |||
| emms_c(); //needed to avoid a emms_c() call before every return; | |||
| emms_c(); //needed to avoid an emms_c() call before every return; | |||
| if (*got_picture_ptr) | |||
| avctx->frame_number++; | |||