1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

--disable-risky support

Originally committed as revision 1522 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2003-01-29 12:00:11 +00:00
parent 02d697aa5f
commit 1d0d55daf4
7 changed files with 125 additions and 65 deletions

10
configure vendored
View File

@ -82,6 +82,7 @@ LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
risky="yes"
# OS specific
targetos=`uname -s`
@ -298,6 +299,8 @@ for opt do
;;
--disable-ffserver) ffserver="no"
;;
--disable-risky) risky="no"
;;
esac
done
@ -587,6 +590,7 @@ echo " --enable-gprof enable profiling with gprof [$gprof]"
echo " --disable-mpegaudio-hp faster (but less accurate)"
echo " mpegaudio decoding [default=no]"
echo " --disable-ffserver disable ffserver build"
echo " --disable-risky disables patent encumbered codecs"
echo ""
echo "NOTE: The object files are build at the place where configure is launched"
exit 1
@ -615,6 +619,7 @@ echo "vorbis enabled $vorbis"
echo "a52 support $a52"
echo "a52 dlopened $a52bin"
echo "Video hooking $vhook"
echo "risky / patent encumbered codecs $risky"
if test "$vhook" = "yes" ; then
echo "Imlib2 support $imlib2"
@ -842,6 +847,11 @@ if test "$ffserver" = "yes" ; then
echo "CONFIG_FFSERVER=yes" >> config.mak
fi
if test "$risky" = "yes" ; then
echo "#define CONFIG_RISKY 1" >> $TMPH
echo "CONFIG_RISKY=yes" >> config.mak
fi
echo "#define restrict $_restrict" >> $TMPH
# build tree in object directory if source path is different from current one

View File

@ -11,14 +11,19 @@ CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_L
LDFLAGS= -g
OBJS= common.o utils.o mem.o allcodecs.o \
mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
motion_est.o imgconvert.o imgresample.o msmpeg4.o \
mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
motion_est.o imgconvert.o imgresample.o \
mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
wmadec.o fft.o mdct.o mace.o huffyuv.o
fft.o mdct.o mace.o huffyuv.o
ASM_OBJS=
# codecs which are patented in some non free countries like the us
ifeq ($(CONFIG_RISKY),yes)
OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o
endif
# currently using liba52 for ac3 decoding
ifeq ($(CONFIG_AC3),yes)
OBJS+= a52dec.o

View File

@ -44,22 +44,25 @@ void avcodec_register_all(void)
register_avcodec(&oggvorbis_decoder);
#endif
register_avcodec(&mpeg1video_encoder);
#ifdef CONFIG_RISKY
register_avcodec(&h263_encoder);
register_avcodec(&h263p_encoder);
register_avcodec(&rv10_encoder);
register_avcodec(&mjpeg_encoder);
register_avcodec(&mpeg4_encoder);
register_avcodec(&msmpeg4v1_encoder);
register_avcodec(&msmpeg4v2_encoder);
register_avcodec(&msmpeg4v3_encoder);
register_avcodec(&wmv1_encoder);
register_avcodec(&wmv2_encoder);
#endif
register_avcodec(&mjpeg_encoder);
register_avcodec(&huffyuv_encoder);
#endif /* CONFIG_ENCODERS */
register_avcodec(&rawvideo_codec);
/* decoders */
#ifdef CONFIG_DECODERS
#ifdef CONFIG_RISKY
register_avcodec(&h263_decoder);
register_avcodec(&mpeg4_decoder);
register_avcodec(&msmpeg4v1_decoder);
@ -67,18 +70,19 @@ void avcodec_register_all(void)
register_avcodec(&msmpeg4v3_decoder);
register_avcodec(&wmv1_decoder);
register_avcodec(&wmv2_decoder);
register_avcodec(&mpeg_decoder);
register_avcodec(&h263i_decoder);
register_avcodec(&rv10_decoder);
register_avcodec(&svq1_decoder);
register_avcodec(&wmav1_decoder);
register_avcodec(&wmav2_decoder);
#endif
register_avcodec(&mpeg_decoder);
register_avcodec(&dvvideo_decoder);
register_avcodec(&dvaudio_decoder);
register_avcodec(&mjpeg_decoder);
register_avcodec(&mjpegb_decoder);
register_avcodec(&mp2_decoder);
register_avcodec(&mp3_decoder);
register_avcodec(&wmav1_decoder);
register_avcodec(&wmav2_decoder);
register_avcodec(&mace3_decoder);
register_avcodec(&mace6_decoder);
register_avcodec(&huffyuv_decoder);

View File

@ -2210,44 +2210,6 @@ static VLC dc_lum, dc_chrom;
static VLC sprite_trajectory;
static VLC mb_type_b_vlc;
void init_rl(RLTable *rl)
{
INT8 max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
UINT8 index_run[MAX_RUN+1];
int last, run, level, start, end, i;
/* compute max_level[], max_run[] and index_run[] */
for(last=0;last<2;last++) {
if (last == 0) {
start = 0;
end = rl->last;
} else {
start = rl->last;
end = rl->n;
}
memset(max_level, 0, MAX_RUN + 1);
memset(max_run, 0, MAX_LEVEL + 1);
memset(index_run, rl->n, MAX_RUN + 1);
for(i=start;i<end;i++) {
run = rl->table_run[i];
level = rl->table_level[i];
if (index_run[run] == rl->n)
index_run[run] = i;
if (level > max_level[run])
max_level[run] = level;
if (run > max_run[level])
max_run[level] = run;
}
rl->max_level[last] = av_malloc(MAX_RUN + 1);
memcpy(rl->max_level[last], max_level, MAX_RUN + 1);
rl->max_run[last] = av_malloc(MAX_LEVEL + 1);
memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1);
rl->index_run[last] = av_malloc(MAX_RUN + 1);
memcpy(rl->index_run[last], index_run, MAX_RUN + 1);
}
}
void init_vlc_rl(RLTable *rl)
{
int i, q;

View File

@ -625,6 +625,7 @@ int MPV_encode_init(AVCodecContext *avctx)
avctx->delay=0;
s->low_delay=1;
break;
#ifdef CONFIG_RISKY
case CODEC_ID_H263:
if (h263_get_picture_format(s->width, s->height) == 7) {
printf("Input picture size isn't suitable for h263 codec! try h263+\n");
@ -704,6 +705,7 @@ int MPV_encode_init(AVCodecContext *avctx)
avctx->delay=0;
s->low_delay=1;
break;
#endif
default:
return -1;
}
@ -741,24 +743,29 @@ int MPV_encode_init(AVCodecContext *avctx)
ff_init_me(s);
#ifdef CONFIG_ENCODERS
#ifdef CONFIG_RISKY
if (s->out_format == FMT_H263)
h263_encode_init(s);
else if (s->out_format == FMT_MPEG1)
ff_mpeg1_encode_init(s);
if(s->msmpeg4_version)
ff_msmpeg4_encode_init(s);
#endif
if (s->out_format == FMT_MPEG1)
ff_mpeg1_encode_init(s);
#endif
/* init default q matrix */
for(i=0;i<64;i++) {
int j= s->idct_permutation[i];
#ifdef CONFIG_RISKY
if(s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){
s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i];
s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i];
}else if(s->out_format == FMT_H263){
s->intra_matrix[j] =
s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
}else{ /* mpeg1 */
}else
#endif
{ /* mpeg1 */
s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i];
s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
}
@ -803,6 +810,44 @@ int MPV_encode_end(AVCodecContext *avctx)
return 0;
}
void init_rl(RLTable *rl)
{
INT8 max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
UINT8 index_run[MAX_RUN+1];
int last, run, level, start, end, i;
/* compute max_level[], max_run[] and index_run[] */
for(last=0;last<2;last++) {
if (last == 0) {
start = 0;
end = rl->last;
} else {
start = rl->last;
end = rl->n;
}
memset(max_level, 0, MAX_RUN + 1);
memset(max_run, 0, MAX_LEVEL + 1);
memset(index_run, rl->n, MAX_RUN + 1);
for(i=start;i<end;i++) {
run = rl->table_run[i];
level = rl->table_level[i];
if (index_run[run] == rl->n)
index_run[run] = i;
if (level > max_level[run])
max_level[run] = level;
if (run > max_run[level])
max_run[level] = run;
}
rl->max_level[last] = av_malloc(MAX_RUN + 1);
memcpy(rl->max_level[last], max_level, MAX_RUN + 1);
rl->max_run[last] = av_malloc(MAX_LEVEL + 1);
memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1);
rl->index_run[last] = av_malloc(MAX_RUN + 1);
memcpy(rl->index_run[last], index_run, MAX_RUN + 1);
}
}
/* draw the edges of width 'w' of an image of size width, height */
//FIXME check that this is ok for mpeg4 interlaced
static void draw_edges_c(UINT8 *buf, int wrap, int width, int height, int w)
@ -1699,6 +1744,7 @@ static inline void MPV_motion(MpegEncContext *s,
switch(s->mv_type) {
case MV_TYPE_16X16:
#ifdef CONFIG_RISKY
if(s->mcsel){
if(s->real_sprite_warping_points==1){
gmc1_motion(s, dest_y, dest_cb, dest_cr, 0,
@ -1716,7 +1762,9 @@ static inline void MPV_motion(MpegEncContext *s,
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
ref_picture, pix_op,
s->mv[dir][0][0], s->mv[dir][0][1], 16);
}else{
}else
#endif
{
mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
ref_picture, 0,
0, pix_op,
@ -2102,9 +2150,12 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
add_dct(s, block[4], 4, dest_cb, s->uvlinesize);
add_dct(s, block[5], 5, dest_cr, s->uvlinesize);
}
} else{
}
#ifdef CONFIG_RISKY
else{
ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
}
#endif
} else {
/* dct only in intra block */
if(s->encoding || !(s->mpeg2 || s->codec_id==CODEC_ID_MPEG1VIDEO)){
@ -2607,6 +2658,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
switch(s->codec_id){ //FIXME funct ptr could be slightly faster
case CODEC_ID_MPEG1VIDEO:
mpeg1_encode_mb(s, s->block, motion_x, motion_y); break;
#ifdef CONFIG_RISKY
case CODEC_ID_MPEG4:
mpeg4_encode_mb(s, s->block, motion_x, motion_y); break;
case CODEC_ID_MSMPEG4V2:
@ -2615,12 +2667,13 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break;
case CODEC_ID_WMV2:
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break;
case CODEC_ID_MJPEG:
mjpeg_encode_mb(s, s->block); break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_RV10:
h263_encode_mb(s, s->block, motion_x, motion_y); break;
#endif
case CODEC_ID_MJPEG:
mjpeg_encode_mb(s, s->block); break;
default:
assert(0);
}
@ -2812,10 +2865,12 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->current_picture.mb_var_sum = 0;
s->current_picture.mc_mb_var_sum = 0;
#ifdef CONFIG_RISKY
/* we need to initialize some time vars before we can encode b-frames */
if (s->h263_pred && !s->h263_msmpeg4)
ff_set_mpeg4_time(s, s->picture_number);
#endif
s->scene_change_score=0;
s->qscale= (int)(s->frame_qscale + 0.5); //FIXME qscale / ... stuff for ME ratedistoration
@ -2924,6 +2979,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->frame_qscale = ff_rate_estimate_qscale(s);
if(s->adaptive_quant){
#ifdef CONFIG_RISKY
switch(s->codec_id){
case CODEC_ID_MPEG4:
ff_clean_mpeg4_qscales(s);
@ -2933,6 +2989,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
ff_clean_h263_qscales(s);
break;
}
#endif
s->qscale= s->current_picture.qscale_table[0];
}else
@ -2962,6 +3019,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
case FMT_MJPEG:
mjpeg_picture_header(s);
break;
#ifdef CONFIG_RISKY
case FMT_H263:
if (s->codec_id == CODEC_ID_WMV2)
ff_wmv2_encode_picture_header(s, picture_number);
@ -2974,6 +3032,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
else
h263_encode_picture_header(s, picture_number);
break;
#endif
case FMT_MPEG1:
mpeg1_encode_picture_header(s, picture_number);
break;
@ -3001,11 +3060,13 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->last_mv[0][0][0] = 0;
s->last_mv[0][0][1] = 0;
#ifdef CONFIG_RISKY
if (s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P)
s->gob_index = ff_h263_get_gob_height(s);
if(s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame)
ff_mpeg4_init_partitions(s);
#endif
s->resync_mb_x=0;
s->resync_mb_y=0;
@ -3038,6 +3099,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->block_index[5]++;
/* write gob / video packet header */
#ifdef CONFIG_RISKY
if(s->rtp_mode){
int current_packet_size, is_gob_start;
@ -3078,6 +3140,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->resync_mb_y=mb_y;
}
}
#endif
if( (s->resync_mb_x == s->mb_x)
&& s->resync_mb_y+1 == s->mb_y){
@ -3152,7 +3215,9 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
s->mb_intra= 0;
#ifdef CONFIG_RISKY
ff_mpeg4_set_direct_mv(s, mx, my);
#endif
encode_mb_hq(s, &backup_s, &best_s, MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
}
@ -3304,7 +3369,9 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->mb_intra= 0;
motion_x=s->b_direct_mv_table[xy][0];
motion_y=s->b_direct_mv_table[xy][1];
#ifdef CONFIG_RISKY
ff_mpeg4_set_direct_mv(s, motion_x, motion_y);
#endif
break;
case MB_TYPE_BIDIR:
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
@ -3382,6 +3449,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
}
emms_c();
#ifdef CONFIG_RISKY
if(s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame)
ff_mpeg4_merge_partitions(s);
@ -3390,6 +3458,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
if(s->codec_id==CODEC_ID_MPEG4)
ff_mpeg4_stuffing(&s->pb);
#endif
//if (s->gob_number)
// fprintf(stderr,"\nNumber of GOB: %d", s->gob_number);
@ -3912,6 +3981,8 @@ AVCodec mpeg1video_encoder = {
MPV_encode_end,
};
#ifdef CONFIG_RISKY
AVCodec h263_encoder = {
"h263",
CODEC_TYPE_VIDEO,
@ -3942,16 +4013,6 @@ AVCodec rv10_encoder = {
MPV_encode_end,
};
AVCodec mjpeg_encoder = {
"mjpeg",
CODEC_TYPE_VIDEO,
CODEC_ID_MJPEG,
sizeof(MpegEncContext),
MPV_encode_init,
MPV_encode_picture,
MPV_encode_end,
};
AVCodec mpeg4_encoder = {
"mpeg4",
CODEC_TYPE_VIDEO,
@ -4002,3 +4063,14 @@ AVCodec wmv1_encoder = {
MPV_encode_end,
};
#endif
AVCodec mjpeg_encoder = {
"mjpeg",
CODEC_TYPE_VIDEO,
CODEC_ID_MJPEG,
sizeof(MpegEncContext),
MPV_encode_init,
MPV_encode_picture,
MPV_encode_end,
};

View File

@ -11,9 +11,14 @@ CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_
OBJS= utils.o cutils.o allformats.o
# mux and demuxes
OBJS+=mpeg.o mpegts.o ffm.o crc.o img.o raw.o rm.o asf.o \
OBJS+=mpeg.o mpegts.o ffm.o crc.o img.o raw.o rm.o \
avienc.o avidec.o wav.o swf.o au.o gif.o mov.o jpeg.o dv.o \
yuv4mpeg.o
ifeq ($(CONFIG_RISKY),yes)
OBJS+= asf.o
endif
# image formats
OBJS+= pnm.o yuv.o
# file I/O

View File

@ -35,7 +35,9 @@ void av_register_all(void)
img_init();
raw_init();
rm_init();
#ifdef CONFIG_RISKY
asf_init();
#endif
avienc_init();
avidec_init();
wav_init();