Mercurial > libavcodec.hg
changeset 487:cee02f2f4a5a libavcodec
grayscale only encoding
author | michaelni |
---|---|
date | Sun, 09 Jun 2002 14:04:36 +0000 |
parents | fde314e1aaa1 |
children | 90227eb98bf9 |
files | mpegvideo.c |
diffstat | 1 files changed, 26 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegvideo.c Sun Jun 09 13:43:53 2002 +0000 +++ b/mpegvideo.c Sun Jun 09 14:04:36 2002 +0000 @@ -1421,12 +1421,17 @@ get_pixels(s->block[2], ptr + 8 * wrap , wrap); get_pixels(s->block[3], ptr + 8 * wrap + 8, wrap); - wrap >>=1; - ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; - get_pixels(s->block[4], ptr, wrap); + if(s->flags&CODEC_FLAG_GRAY){ + skip_dct[4]= 1; + skip_dct[5]= 1; + }else{ + wrap >>=1; + ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; + get_pixels(s->block[4], ptr, wrap); - ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; - get_pixels(s->block[5], ptr, wrap); + ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; + get_pixels(s->block[5], ptr, wrap); + } }else{ op_pixels_func *op_pix; qpel_mc_func *op_qpix; @@ -1466,9 +1471,15 @@ diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); diff_pixels(s->block[2], ptr_y + 8 * wrap_y , dest_y + 8 * wrap_y , wrap_y); diff_pixels(s->block[3], ptr_y + 8 * wrap_y + 8, dest_y + 8 * wrap_y + 8, wrap_y); - diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); - diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); - + + if(s->flags&CODEC_FLAG_GRAY){ + skip_dct[4]= 1; + skip_dct[5]= 1; + }else{ + diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); + diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); + } + /* pre quantization */ if(s->mc_mb_var[s->mb_width*mb_y+ mb_x]<2*s->qscale*s->qscale){ if(pix_abs8x8(ptr_y , dest_y , wrap_y) < 20*s->qscale) skip_dct[0]= 1; @@ -1546,6 +1557,13 @@ dct_single_coeff_elimination(s, i, s->chroma_elim_threshold, 1); } + if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){ + s->block_last_index[4]= + s->block_last_index[5]= 0; + s->block[4][0]= + s->block[5][0]= 128; + } + /* huffman encode */ switch(s->out_format) { case FMT_MPEG1: