mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-21 14:26:59 +00:00
grayscale only encoding
Originally committed as revision 679 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
0398717356
commit
6282185e82
@ -1421,12 +1421,17 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||||||
get_pixels(s->block[2], ptr + 8 * wrap , wrap);
|
get_pixels(s->block[2], ptr + 8 * wrap , wrap);
|
||||||
get_pixels(s->block[3], ptr + 8 * wrap + 8, wrap);
|
get_pixels(s->block[3], ptr + 8 * wrap + 8, wrap);
|
||||||
|
|
||||||
|
if(s->flags&CODEC_FLAG_GRAY){
|
||||||
|
skip_dct[4]= 1;
|
||||||
|
skip_dct[5]= 1;
|
||||||
|
}else{
|
||||||
wrap >>=1;
|
wrap >>=1;
|
||||||
ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8;
|
ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8;
|
||||||
get_pixels(s->block[4], ptr, wrap);
|
get_pixels(s->block[4], ptr, wrap);
|
||||||
|
|
||||||
ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8;
|
ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8;
|
||||||
get_pixels(s->block[5], ptr, wrap);
|
get_pixels(s->block[5], ptr, wrap);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
op_pixels_func *op_pix;
|
op_pixels_func *op_pix;
|
||||||
qpel_mc_func *op_qpix;
|
qpel_mc_func *op_qpix;
|
||||||
@ -1466,8 +1471,14 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||||||
diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);
|
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[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[3], ptr_y + 8 * wrap_y + 8, dest_y + 8 * wrap_y + 8, wrap_y);
|
||||||
|
|
||||||
|
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[4], ptr_cb, dest_cb, wrap_c);
|
||||||
diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
|
diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
|
||||||
|
}
|
||||||
|
|
||||||
/* pre quantization */
|
/* pre quantization */
|
||||||
if(s->mc_mb_var[s->mb_width*mb_y+ mb_x]<2*s->qscale*s->qscale){
|
if(s->mc_mb_var[s->mb_width*mb_y+ mb_x]<2*s->qscale*s->qscale){
|
||||||
@ -1546,6 +1557,13 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||||||
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold, 1);
|
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 */
|
/* huffman encode */
|
||||||
switch(s->out_format) {
|
switch(s->out_format) {
|
||||||
case FMT_MPEG1:
|
case FMT_MPEG1:
|
||||||
|
Loading…
Reference in New Issue
Block a user