-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-static int mpeg4_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
- ParseContext *pc= &s->parse_context;
- int vop_found, i;
- uint32_t state;
-
- vop_found= pc->frame_start_found;
- state= pc->state;
-
- i=0;
- if(!vop_found){
- for(i=0; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if(state == 0x1B6){
- i++;
- vop_found=1;
- break;
- }
- }
- }
-
- if(vop_found){
- for(; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if((state&0xFFFFFF00) == 0x100){
- pc->frame_start_found=0;
- pc->state=-1;
- return i-3;
- }
- }
- }
- pc->frame_start_found= vop_found;
- pc->state= state;
- return END_NOT_FOUND;
-}
-
-static int h263_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
- ParseContext *pc= &s->parse_context;
- int vop_found, i;
- uint32_t state;
-
- vop_found= pc->frame_start_found;
- state= pc->state;
-
- i=0;
- if(!vop_found){
- for(i=0; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if(state>>(32-22) == 0x20){
- i++;
- vop_found=1;
- break;
- }
- }
- }
-
- if(vop_found){
- for(; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if(state>>(32-22) == 0x20){
- pc->frame_start_found=0;
- pc->state=-1;
- return i-3;
- }
- }
- }
- pc->frame_start_found= vop_found;
- pc->state= state;
-
- return END_NOT_FOUND;
-}
-
-int ff_h263_decode_frame(AVCodecContext *avctx,