Mercurial > libavcodec.hg
comparison mpegvideo.c @ 1368:0fd38b711f06 libavcodec
AVCodec.flush()
ff_draw_horiz_band() in coded order / cleanup
author | michaelni |
---|---|
date | Thu, 17 Jul 2003 12:29:07 +0000 |
parents | 1f89adb69349 |
children | 8a150a66d2d9 |
comparison
equal
deleted
inserted
replaced
1367:b33c63b53cef | 1368:0fd38b711f06 |
---|---|
2723 /** | 2723 /** |
2724 * | 2724 * |
2725 * @param h is the normal height, this will be reduced automatically if needed for the last row | 2725 * @param h is the normal height, this will be reduced automatically if needed for the last row |
2726 */ | 2726 */ |
2727 void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ | 2727 void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ |
2728 if ( s->avctx->draw_horiz_band | 2728 if (s->avctx->draw_horiz_band) { |
2729 && (s->last_picture_ptr || s->low_delay) ) { | |
2730 uint8_t *src_ptr[3]; | 2729 uint8_t *src_ptr[3]; |
2731 int offset; | 2730 int offset[4]; |
2732 h= FFMIN(h, s->height - y); | 2731 h= FFMIN(h, s->height - y); |
2733 | 2732 |
2734 if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME) | 2733 if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME){ |
2735 offset = 0; | 2734 offset[0]= |
2736 else | 2735 offset[1]= |
2737 offset = y * s->linesize; | 2736 offset[2]= |
2738 | 2737 offset[3]= 0; |
2739 if(s->pict_type==B_TYPE || s->low_delay){ | 2738 }else{ |
2740 src_ptr[0] = s->current_picture.data[0] + offset; | 2739 offset[0]= y * s->linesize;; |
2741 src_ptr[1] = s->current_picture.data[1] + (offset >> 2); | 2740 offset[1]= |
2742 src_ptr[2] = s->current_picture.data[2] + (offset >> 2); | 2741 offset[2]= (y>>1) * s->uvlinesize;; |
2743 } else { | 2742 offset[3]= 0; |
2744 src_ptr[0] = s->last_picture.data[0] + offset; | 2743 } |
2745 src_ptr[1] = s->last_picture.data[1] + (offset >> 2); | 2744 |
2746 src_ptr[2] = s->last_picture.data[2] + (offset >> 2); | |
2747 } | |
2748 emms_c(); | 2745 emms_c(); |
2749 | 2746 |
2750 s->avctx->draw_horiz_band(s->avctx, src_ptr, s->linesize, | 2747 s->avctx->draw_horiz_band(s->avctx, (AVFrame*)s->current_picture_ptr, offset, |
2751 y, s->width, h); | 2748 y, s->width, h); |
2752 } | 2749 } |
2753 } | 2750 } |
2754 | 2751 |
2755 #ifdef CONFIG_ENCODERS | 2752 #ifdef CONFIG_ENCODERS |
3072 printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); | 3069 printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); |
3073 } | 3070 } |
3074 #endif | 3071 #endif |
3075 | 3072 |
3076 return 0; | 3073 return 0; |
3074 } | |
3075 | |
3076 void ff_mpeg_flush(AVCodecContext *avctx){ | |
3077 int i; | |
3078 MpegEncContext *s = avctx->priv_data; | |
3079 | |
3080 for(i=0; i<MAX_PICTURE_COUNT; i++){ | |
3081 if(s->picture[i].data[0] && ( s->picture[i].type == FF_BUFFER_TYPE_INTERNAL | |
3082 || s->picture[i].type == FF_BUFFER_TYPE_USER)) | |
3083 avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]); | |
3084 } | |
3085 s->last_picture_ptr = s->next_picture_ptr = NULL; | |
3077 } | 3086 } |
3078 | 3087 |
3079 #ifdef CONFIG_ENCODERS | 3088 #ifdef CONFIG_ENCODERS |
3080 void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) | 3089 void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) |
3081 { | 3090 { |