summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 69b06bcfb3..a24500dabf 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2725,29 +2725,26 @@ static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move
* @param h is the normal height, this will be reduced automatically if needed for the last row
*/
void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
- if ( s->avctx->draw_horiz_band
- && (s->last_picture_ptr || s->low_delay) ) {
+ if (s->avctx->draw_horiz_band) {
uint8_t *src_ptr[3];
- int offset;
+ int offset[4];
h= FFMIN(h, s->height - y);
- if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME)
- offset = 0;
- else
- offset = y * s->linesize;
-
- if(s->pict_type==B_TYPE || s->low_delay){
- src_ptr[0] = s->current_picture.data[0] + offset;
- src_ptr[1] = s->current_picture.data[1] + (offset >> 2);
- src_ptr[2] = s->current_picture.data[2] + (offset >> 2);
- } else {
- src_ptr[0] = s->last_picture.data[0] + offset;
- src_ptr[1] = s->last_picture.data[1] + (offset >> 2);
- src_ptr[2] = s->last_picture.data[2] + (offset >> 2);
+ if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME){
+ offset[0]=
+ offset[1]=
+ offset[2]=
+ offset[3]= 0;
+ }else{
+ offset[0]= y * s->linesize;;
+ offset[1]=
+ offset[2]= (y>>1) * s->uvlinesize;;
+ offset[3]= 0;
}
+
emms_c();
- s->avctx->draw_horiz_band(s->avctx, src_ptr, s->linesize,
+ s->avctx->draw_horiz_band(s->avctx, (AVFrame*)s->current_picture_ptr, offset,
y, s->width, h);
}
}
@@ -3076,6 +3073,18 @@ int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size)
return 0;
}
+void ff_mpeg_flush(AVCodecContext *avctx){
+ int i;
+ MpegEncContext *s = avctx->priv_data;
+
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && ( s->picture[i].type == FF_BUFFER_TYPE_INTERNAL
+ || s->picture[i].type == FF_BUFFER_TYPE_USER))
+ avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
+ }
+ s->last_picture_ptr = s->next_picture_ptr = NULL;
+}
+
#ifdef CONFIG_ENCODERS
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
{