Commit 6ab7012f authored by stefano's avatar stefano

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.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21575 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9710d98a
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* #define DEBUG */ /* #define DEBUG */
#include "libavcodec/imgconvert.h" #include "libavcodec/imgconvert.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h" #include "avfilter.h"
unsigned avfilter_version(void) { unsigned avfilter_version(void) {
...@@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end) ...@@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end)
dprintf(ctx, dprintf(ctx,
"link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
link, link->w, link->h, 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->src ? link->src->filter->name : "",
link->dst ? link->dst->filter->name : "", link->dst ? link->dst->filter->name : "",
end ? "\n" : ""); end ? "\n" : "");
...@@ -298,7 +299,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) ...@@ -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 */ /* copy the slice if needed for permission reasons */
if(link->srcpic) { 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 ++) { for(i = 0; i < 4; i ++) {
if(link->srcpic->data[i]) { if(link->srcpic->data[i]) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include "avfilter.h" #include "avfilter.h"
#include "libavutil/pixdesc.h"
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
typedef struct { typedef struct {
...@@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink) ...@@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink)
SWS_BILINEAR, NULL, NULL, NULL); SWS_BILINEAR, NULL, NULL, NULL);
av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n", 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 || scale->input_is_pal = inlink->format == PIX_FMT_PAL8 ||
inlink->format == PIX_FMT_BGR4_BYTE || inlink->format == PIX_FMT_BGR4_BYTE ||
...@@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) ...@@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
AVFilterLink *outlink = link->dst->outputs[0]; AVFilterLink *outlink = link->dst->outputs[0];
AVFilterPicRef *outpicref; 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 = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
outpicref->pts = picref->pts; outpicref->pts = picref->pts;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include "avfilter.h" #include "avfilter.h"
#include "libavutil/pixdesc.h"
typedef struct { typedef struct {
int h; ///< output slice height int h; ///< output slice height
...@@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) ...@@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int config_props(AVFilterLink *link) static int config_props(AVFilterLink *link)
{ {
SliceContext *slice = link->dst->priv; 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 /* ensure that slices play nice with chroma subsampling, and enforce
* a reasonable minimum size for the slices */ * a reasonable minimum size for the slices */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* video vertical flip filter * video vertical flip filter
*/ */
#include "libavutil/pixdesc.h"
#include "avfilter.h" #include "avfilter.h"
typedef struct { typedef struct {
...@@ -32,9 +33,8 @@ typedef struct { ...@@ -32,9 +33,8 @@ typedef struct {
static int config_input(AVFilterLink *link) static int config_input(AVFilterLink *link)
{ {
FlipContext *flip = link->dst->priv; 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; return 0;
} }
......
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