comparison mpegvideo.c @ 4396:8e78248586b0 libavcodec

set last_picture for h.264 too, this significantly improves error concealment quality, i hope it doesnt break anything as last_picture_ptr was always NULL for h.264
author michael
date Wed, 24 Jan 2007 14:20:00 +0000
parents 855350bd0daf
children daa2a095181d
comparison
equal deleted inserted replaced
4395:b0bfea78ca13 4396:8e78248586b0
1536 1536
1537 assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3); 1537 assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
1538 1538
1539 /* mark&release old frames */ 1539 /* mark&release old frames */
1540 if (s->pict_type != B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) { 1540 if (s->pict_type != B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) {
1541 if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){
1541 avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr); 1542 avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr);
1542 1543
1543 /* release forgotten pictures */ 1544 /* release forgotten pictures */
1544 /* if(mpeg124/h263) */ 1545 /* if(mpeg124/h263) */
1545 if(!s->encoding){ 1546 if(!s->encoding){
1548 av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n"); 1549 av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
1549 avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]); 1550 avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
1550 } 1551 }
1551 } 1552 }
1552 } 1553 }
1554 }
1553 } 1555 }
1554 alloc: 1556 alloc:
1555 if(!s->encoding){ 1557 if(!s->encoding){
1556 /* release non reference frames */ 1558 /* release non reference frames */
1557 for(i=0; i<MAX_PICTURE_COUNT; i++){ 1559 for(i=0; i<MAX_PICTURE_COUNT; i++){
1585 // s->current_picture_ptr->quality= s->new_picture_ptr->quality; 1587 // s->current_picture_ptr->quality= s->new_picture_ptr->quality;
1586 s->current_picture_ptr->key_frame= s->pict_type == I_TYPE; 1588 s->current_picture_ptr->key_frame= s->pict_type == I_TYPE;
1587 1589
1588 copy_picture(&s->current_picture, s->current_picture_ptr); 1590 copy_picture(&s->current_picture, s->current_picture_ptr);
1589 1591
1590 if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){
1591 if (s->pict_type != B_TYPE) { 1592 if (s->pict_type != B_TYPE) {
1592 s->last_picture_ptr= s->next_picture_ptr; 1593 s->last_picture_ptr= s->next_picture_ptr;
1593 if(!s->dropable) 1594 if(!s->dropable)
1594 s->next_picture_ptr= s->current_picture_ptr; 1595 s->next_picture_ptr= s->current_picture_ptr;
1595 } 1596 }
1619 s->current_picture.linesize[i] *= 2; 1620 s->current_picture.linesize[i] *= 2;
1620 s->last_picture.linesize[i] *=2; 1621 s->last_picture.linesize[i] *=2;
1621 s->next_picture.linesize[i] *=2; 1622 s->next_picture.linesize[i] *=2;
1622 } 1623 }
1623 } 1624 }
1624 }
1625 1625
1626 s->hurry_up= s->avctx->hurry_up; 1626 s->hurry_up= s->avctx->hurry_up;
1627 s->error_resilience= avctx->error_resilience; 1627 s->error_resilience= avctx->error_resilience;
1628 1628
1629 /* set dequantizer, we can't do it during init as it might change for mpeg4 1629 /* set dequantizer, we can't do it during init as it might change for mpeg4