comparison h264.c @ 5773:e3d7a78e2df3 libavcodec

Fix Picture.key_frame setting to be compatible with frame and field contexts. Part of PAFF implementation. Contributed in part by Neil Brown. patch by Jeff Downs, heydowns a borg d com original thread: Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264 Date: 18/09/07 20:30
author andoma
date Thu, 04 Oct 2007 06:50:44 +0000
parents 65b71bd21a4d
children e71de81878c4
comparison
equal deleted inserted replaced
5772:65b71bd21a4d 5773:e3d7a78e2df3
2247 int i; 2247 int i;
2248 2248
2249 if(MPV_frame_start(s, s->avctx) < 0) 2249 if(MPV_frame_start(s, s->avctx) < 0)
2250 return -1; 2250 return -1;
2251 ff_er_frame_start(s); 2251 ff_er_frame_start(s);
2252 /*
2253 * MPV_frame_start uses pict_type to derive key_frame.
2254 * This is incorrect for H.264; IDR markings must be used.
2255 * Zero here; IDR markings per slice in frame or fields are OR'd in later.
2256 * See decode_nal_units().
2257 */
2258 s->current_picture_ptr->key_frame= 0;
2252 2259
2253 assert(s->linesize && s->uvlinesize); 2260 assert(s->linesize && s->uvlinesize);
2254 2261
2255 for(i=0; i<16; i++){ 2262 for(i=0; i<16; i++){
2256 h->block_offset[i]= 4*((scan8[i] - scan8[0])&7) + 4*s->linesize*((scan8[i] - scan8[0])>>3); 2263 h->block_offset[i]= 4*((scan8[i] - scan8[0])&7) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
7187 hx->s.data_partitioning = 0; 7194 hx->s.data_partitioning = 0;
7188 7195
7189 if((err = decode_slice_header(hx, h))) 7196 if((err = decode_slice_header(hx, h)))
7190 break; 7197 break;
7191 7198
7192 s->current_picture_ptr->key_frame= (hx->nal_unit_type == NAL_IDR_SLICE); 7199 s->current_picture_ptr->key_frame|= (hx->nal_unit_type == NAL_IDR_SLICE);
7193 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 7200 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
7194 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) 7201 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
7195 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=B_TYPE) 7202 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=B_TYPE)
7196 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==I_TYPE) 7203 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==I_TYPE)
7197 && avctx->skip_frame < AVDISCARD_ALL) 7204 && avctx->skip_frame < AVDISCARD_ALL)