summaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-07-17 12:29:07 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-07-17 12:29:07 +0000
commit7a06ff148d0321e863a682334c59f59b3e8e7b6d (patch)
tree4b6b4fd27b6fb39589517a0bfde54f701d319130 /libavcodec/mpegvideo.c
parentbc3513865a10f0f070bdc4eafd4e0df2b2ca3f6d (diff)
downloadffmpeg-streaming-7a06ff148d0321e863a682334c59f59b3e8e7b6d.zip
ffmpeg-streaming-7a06ff148d0321e863a682334c59f59b3e8e7b6d.tar.gz
AVCodec.flush()
ff_draw_horiz_band() in coded order / cleanup Originally committed as revision 2064 to svn://svn.ffmpeg.org/ffmpeg/trunk
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 69b06bc..a24500d 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)
{
OpenPOWER on IntegriCloud