Mercurial > libavcodec.hg
comparison h264.c @ 9069:8a74ab19d224 libavcodec
Correctly reset SEI variables.
Patch by Ivan Schreter, schreter gmx net
author | cehoyos |
---|---|
date | Fri, 27 Feb 2009 21:28:41 +0000 |
parents | 77cbbce1be94 |
children | d1238ea3db6f |
comparison
equal
deleted
inserted
replaced
9068:520877b559cb | 9069:8a74ab19d224 |
---|---|
2159 | 2159 |
2160 memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t)); | 2160 memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t)); |
2161 memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t)); | 2161 memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t)); |
2162 } | 2162 } |
2163 | 2163 |
2164 /** | |
2165 * Reset SEI values at the beginning of the frame. | |
2166 * | |
2167 * @param h H.264 context. | |
2168 */ | |
2169 static void reset_sei(H264Context *h) { | |
2170 h->sei_recovery_frame_cnt = -1; | |
2171 h->sei_dpb_output_delay = 0; | |
2172 h->sei_cpb_removal_delay = -1; | |
2173 h->sei_buffering_period_present = 0; | |
2174 } | |
2175 | |
2164 static av_cold int decode_init(AVCodecContext *avctx){ | 2176 static av_cold int decode_init(AVCodecContext *avctx){ |
2165 H264Context *h= avctx->priv_data; | 2177 H264Context *h= avctx->priv_data; |
2166 MpegEncContext * const s = &h->s; | 2178 MpegEncContext * const s = &h->s; |
2167 | 2179 |
2168 MPV_decode_defaults(s); | 2180 MPV_decode_defaults(s); |
2195 } | 2207 } |
2196 | 2208 |
2197 h->thread_context[0] = h; | 2209 h->thread_context[0] = h; |
2198 h->outputed_poc = INT_MIN; | 2210 h->outputed_poc = INT_MIN; |
2199 h->prev_poc_msb= 1<<16; | 2211 h->prev_poc_msb= 1<<16; |
2200 h->sei_recovery_frame_cnt = -1; | 2212 reset_sei(h); |
2201 h->sei_dpb_output_delay = 0; | |
2202 h->sei_cpb_removal_delay = -1; | |
2203 h->sei_buffering_period_present = 0; | |
2204 if(avctx->codec_id == CODEC_ID_H264) | 2213 if(avctx->codec_id == CODEC_ID_H264) |
2205 avctx->ticks_per_frame = 2; | 2214 avctx->ticks_per_frame = 2; |
2206 return 0; | 2215 return 0; |
2207 } | 2216 } |
2208 | 2217 |
3135 h->outputed_poc= INT_MIN; | 3144 h->outputed_poc= INT_MIN; |
3136 idr(h); | 3145 idr(h); |
3137 if(h->s.current_picture_ptr) | 3146 if(h->s.current_picture_ptr) |
3138 h->s.current_picture_ptr->reference= 0; | 3147 h->s.current_picture_ptr->reference= 0; |
3139 h->s.first_field= 0; | 3148 h->s.first_field= 0; |
3140 h->sei_recovery_frame_cnt = -1; | 3149 reset_sei(h); |
3141 h->sei_dpb_output_delay = 0; | |
3142 h->sei_cpb_removal_delay = -1; | |
3143 h->sei_buffering_period_present = 0; | |
3144 ff_mpeg_flush(avctx); | 3150 ff_mpeg_flush(avctx); |
3145 } | 3151 } |
3146 | 3152 |
3147 /** | 3153 /** |
3148 * Find a Picture in the short term reference list by frame number. | 3154 * Find a Picture in the short term reference list by frame number. |
7405 #endif | 7411 #endif |
7406 if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ | 7412 if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ |
7407 h->current_slice = 0; | 7413 h->current_slice = 0; |
7408 if (!s->first_field) | 7414 if (!s->first_field) |
7409 s->current_picture_ptr= NULL; | 7415 s->current_picture_ptr= NULL; |
7416 reset_sei(h); | |
7410 } | 7417 } |
7411 | 7418 |
7412 for(;;){ | 7419 for(;;){ |
7413 int consumed; | 7420 int consumed; |
7414 int dst_length; | 7421 int dst_length; |
7742 */ | 7749 */ |
7743 if (!FIELD_PICTURE) | 7750 if (!FIELD_PICTURE) |
7744 ff_er_frame_end(s); | 7751 ff_er_frame_end(s); |
7745 | 7752 |
7746 MPV_frame_end(s); | 7753 MPV_frame_end(s); |
7747 h->sei_recovery_frame_cnt = -1; | |
7748 h->sei_dpb_output_delay = 0; | |
7749 h->sei_cpb_removal_delay = -1; | |
7750 h->sei_buffering_period_present = 0; | |
7751 | 7754 |
7752 if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) { | 7755 if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) { |
7753 /* Wait for second field. */ | 7756 /* Wait for second field. */ |
7754 *data_size = 0; | 7757 *data_size = 0; |
7755 | 7758 |