diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-01-31 16:33:29 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-01-31 16:33:29 +0000 |
commit | b4b664565573e0c54474c7bfb6adc19cb7b28a55 (patch) | |
tree | a544693925d18b353e8b4ee8c28ba07c6e97686f | |
parent | 971c55f18680020908eeae3972bd20b36921b7e1 (diff) | |
download | ffmpeg-b4b664565573e0c54474c7bfb6adc19cb7b28a55.tar.gz |
Avoid usage of avcodec_get_pix_fmt_name() and
avcodec_get_chroma_sub_sample(), directly access
av_pix_fmt_descriptors instead.
Remove some of the dependancies of lavfi on lavc.
Originally committed as revision 21575 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavfilter/avfilter.c | 6 | ||||
-rw-r--r-- | libavfilter/vf_scale.c | 6 | ||||
-rw-r--r-- | libavfilter/vf_slicify.c | 4 | ||||
-rw-r--r-- | libavfilter/vf_vflip.c | 4 |
4 files changed, 12 insertions, 8 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 959a2414c7..e28f1c7390 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -22,6 +22,7 @@ /* #define DEBUG */ #include "libavcodec/imgconvert.h" +#include "libavutil/pixdesc.h" #include "avfilter.h" unsigned avfilter_version(void) { @@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end) dprintf(ctx, "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", link, link->w, link->h, - avcodec_get_pix_fmt_name(link->format), + av_pix_fmt_descriptors[link->format].name, link->src ? link->src->filter->name : "", link->dst ? link->dst->filter->name : "", end ? "\n" : ""); @@ -298,7 +299,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) /* copy the slice if needed for permission reasons */ if(link->srcpic) { - avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); + hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; + vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; for(i = 0; i < 4; i ++) { if(link->srcpic->data[i]) { diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 6ccdde26c0..e0f37685fb 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -24,6 +24,7 @@ */ #include "avfilter.h" +#include "libavutil/pixdesc.h" #include "libswscale/swscale.h" typedef struct { @@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink) SWS_BILINEAR, NULL, NULL, NULL); av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n", - outlink->w, outlink->h, avcodec_get_pix_fmt_name(outlink->format)); + outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name); scale->input_is_pal = inlink->format == PIX_FMT_PAL8 || inlink->format == PIX_FMT_BGR4_BYTE || @@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) AVFilterLink *outlink = link->dst->outputs[0]; AVFilterPicRef *outpicref; - avcodec_get_chroma_sub_sample(link->format, &scale->hsub, &scale->vsub); + scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; + scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); outpicref->pts = picref->pts; diff --git a/libavfilter/vf_slicify.c b/libavfilter/vf_slicify.c index b5e9544b3f..d1c9fbc6ac 100644 --- a/libavfilter/vf_slicify.c +++ b/libavfilter/vf_slicify.c @@ -24,6 +24,7 @@ */ #include "avfilter.h" +#include "libavutil/pixdesc.h" typedef struct { int h; ///< output slice height @@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) static int config_props(AVFilterLink *link) { SliceContext *slice = link->dst->priv; - int tmp; - avcodec_get_chroma_sub_sample(link->format, &tmp, &slice->vshift); + slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h; /* ensure that slices play nice with chroma subsampling, and enforce * a reasonable minimum size for the slices */ diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index 39c0405c04..9c0e80adf5 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -23,6 +23,7 @@ * video vertical flip filter */ +#include "libavutil/pixdesc.h" #include "avfilter.h" typedef struct { @@ -32,9 +33,8 @@ typedef struct { static int config_input(AVFilterLink *link) { FlipContext *flip = link->dst->priv; - int tmp; - avcodec_get_chroma_sub_sample(link->format, &tmp, &flip->vsub); + flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; return 0; } |