comparison h263.c @ 9024:2bf694251330 libavcodec

Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker, if any. patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom based on suggested implementation by me
author michael
date Tue, 24 Feb 2009 16:12:47 +0000
parents 251c7a9cb795
children e9ba8210d495
comparison
equal deleted inserted replaced
9023:c753d074bbed 9024:2bf694251330
3291 s->last_mv[1][0][0]= 3291 s->last_mv[1][0][0]=
3292 s->last_mv[1][0][1]= 0; 3292 s->last_mv[1][0][1]= 0;
3293 } 3293 }
3294 3294
3295 /** 3295 /**
3296 * finds the next resync_marker
3297 * @param p pointer to buffer to scan
3298 * @param end pointer to the end of the buffer
3299 * @return pointer to the next resync_marker, or \p end if none was found
3300 */
3301 const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8_t * restrict end)
3302 {
3303 assert(p < end);
3304
3305 end-=2;
3306 p++;
3307 for(;p<end; p+=2){
3308 if(!*p){
3309 if (!p[-1] && p[1]) return p - 1;
3310 else if(!p[ 1] && p[2]) return p;
3311 }
3312 }
3313 return end+2;
3314 }
3315
3316 /**
3296 * decodes the group of blocks / video packet header. 3317 * decodes the group of blocks / video packet header.
3297 * @return bit position of the resync_marker, or <0 if none was found 3318 * @return bit position of the resync_marker, or <0 if none was found
3298 */ 3319 */
3299 int ff_h263_resync(MpegEncContext *s){ 3320 int ff_h263_resync(MpegEncContext *s){
3300 int left, pos, ret; 3321 int left, pos, ret;