Commit ca1bb8aa authored by michael's avatar michael

make grayscale only decoding checks in inner loops compiletime killable


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9846 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3cdc5298
...@@ -133,6 +133,7 @@ show_help(){ ...@@ -133,6 +133,7 @@ show_help(){
echo " --disable-debug disable debugging symbols" echo " --disable-debug disable debugging symbols"
echo " --disable-mpegaudio-hp faster (but less accurate)" echo " --disable-mpegaudio-hp faster (but less accurate)"
echo " MPEG audio decoding [default=no]" echo " MPEG audio decoding [default=no]"
echo " --enable-gray enable full grayscale support (slower color)"
echo " --disable-ffmpeg disable ffmpeg build" echo " --disable-ffmpeg disable ffmpeg build"
echo " --disable-ffserver disable ffserver build" echo " --disable-ffserver disable ffserver build"
echo " --disable-ffplay disable ffplay build" echo " --disable-ffplay disable ffplay build"
...@@ -615,6 +616,7 @@ CONFIG_LIST=' ...@@ -615,6 +616,7 @@ CONFIG_LIST='
v4l2 v4l2
x11grab x11grab
zlib zlib
gray
' '
THREADS_LIST=' THREADS_LIST='
...@@ -860,6 +862,7 @@ network="yes" ...@@ -860,6 +862,7 @@ network="yes"
optimize="yes" optimize="yes"
protocols="yes" protocols="yes"
vhook="default" vhook="default"
gray="no"
# build settings # build settings
SHFLAGS='-shared -Wl,-soname,$@' SHFLAGS='-shared -Wl,-soname,$@'
......
...@@ -1554,7 +1554,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ...@@ -1554,7 +1554,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
src_x, src_y<<field_based, h_edge_pos, v_edge_pos); src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
ptr_y = s->edge_emu_buffer; ptr_y = s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1); uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
...@@ -1581,7 +1581,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ...@@ -1581,7 +1581,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
sy <<= 2 - lowres; sy <<= 2 - lowres;
pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy); pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uvsx <<= 2 - lowres; uvsx <<= 2 - lowres;
uvsy <<= 2 - lowres; uvsy <<= 2 - lowres;
pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
...@@ -1687,7 +1687,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, ...@@ -1687,7 +1687,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s,
my += s->mv[dir][i][1]; my += s->mv[dir][i][1];
} }
if(!(s->flags&CODEC_FLAG_GRAY)) if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY))
chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my); chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my);
break; break;
case MV_TYPE_FIELD: case MV_TYPE_FIELD:
...@@ -1974,7 +1974,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b ...@@ -1974,7 +1974,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b
add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if (s->chroma_y_shift){ if (s->chroma_y_shift){
add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
...@@ -1993,7 +1993,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b ...@@ -1993,7 +1993,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b
add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if(s->chroma_y_shift){//Chroma420 if(s->chroma_y_shift){//Chroma420
add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[4], 4, dest_cb, uvlinesize);
add_dct(s, block[5], 5, dest_cr, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize);
...@@ -2026,7 +2026,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b ...@@ -2026,7 +2026,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b
put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if(s->chroma_y_shift){ if(s->chroma_y_shift){
put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
...@@ -2045,7 +2045,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b ...@@ -2045,7 +2045,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b
s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]); s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]);
s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if(s->chroma_y_shift){ if(s->chroma_y_shift){
s->dsp.idct_put(dest_cb, uvlinesize, block[4]); s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
s->dsp.idct_put(dest_cr, uvlinesize, block[5]); s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
......
...@@ -104,7 +104,7 @@ static inline void gmc1_motion(MpegEncContext *s, ...@@ -104,7 +104,7 @@ static inline void gmc1_motion(MpegEncContext *s,
} }
} }
if(s->flags&CODEC_FLAG_GRAY) return; if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return;
motion_x= s->sprite_offset[1][0]; motion_x= s->sprite_offset[1][0];
motion_y= s->sprite_offset[1][1]; motion_y= s->sprite_offset[1][1];
...@@ -173,7 +173,7 @@ static inline void gmc_motion(MpegEncContext *s, ...@@ -173,7 +173,7 @@ static inline void gmc_motion(MpegEncContext *s,
a+1, (1<<(2*a+1)) - s->no_rounding, a+1, (1<<(2*a+1)) - s->no_rounding,
s->h_edge_pos, s->v_edge_pos); s->h_edge_pos, s->v_edge_pos);
if(s->flags&CODEC_FLAG_GRAY) return; if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return;
ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8; ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8;
oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8; oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8;
...@@ -318,7 +318,7 @@ if(s->quarter_sample) ...@@ -318,7 +318,7 @@ if(s->quarter_sample)
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos); src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
ptr_y = s->edge_emu_buffer; ptr_y = s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
...@@ -343,7 +343,7 @@ if(s->quarter_sample) ...@@ -343,7 +343,7 @@ if(s->quarter_sample)
pix_op[0][dxy](dest_y, ptr_y, linesize, h); pix_op[0][dxy](dest_y, ptr_y, linesize, h);
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
} }
...@@ -485,7 +485,7 @@ static inline void qpel_motion(MpegEncContext *s, ...@@ -485,7 +485,7 @@ static inline void qpel_motion(MpegEncContext *s,
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos); src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
ptr_y= s->edge_emu_buffer; ptr_y= s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize; uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based, ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
...@@ -515,7 +515,7 @@ static inline void qpel_motion(MpegEncContext *s, ...@@ -515,7 +515,7 @@ static inline void qpel_motion(MpegEncContext *s,
qpix_op[1][dxy](dest_y , ptr_y , linesize); qpix_op[1][dxy](dest_y , ptr_y , linesize);
qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize); qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
} }
if(!(s->flags&CODEC_FLAG_GRAY)){ if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1); pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1);
pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1); pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1);
} }
...@@ -663,7 +663,7 @@ static inline void MPV_motion(MpegEncContext *s, ...@@ -663,7 +663,7 @@ static inline void MPV_motion(MpegEncContext *s,
mx += mv[0][0]; mx += mv[0][0];
my += mv[0][1]; my += mv[0][1];
} }
if(!(s->flags&CODEC_FLAG_GRAY)) if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY))
chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
return; return;
...@@ -745,7 +745,7 @@ static inline void MPV_motion(MpegEncContext *s, ...@@ -745,7 +745,7 @@ static inline void MPV_motion(MpegEncContext *s,
} }
} }
if(!(s->flags&CODEC_FLAG_GRAY)) if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY))
chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
break; break;
case MV_TYPE_FIELD: case MV_TYPE_FIELD:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment