Browse code

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

Stefano Sabatini authored on 2010/02/01 01:33:29
Showing 4 changed files
... ...
@@ -22,6 +22,7 @@
22 22
 /* #define DEBUG */
23 23
 
24 24
 #include "libavcodec/imgconvert.h"
25
+#include "libavutil/pixdesc.h"
25 26
 #include "avfilter.h"
26 27
 
27 28
 unsigned avfilter_version(void) {
... ...
@@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end)
183 183
     dprintf(ctx,
184 184
             "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
185 185
             link, link->w, link->h,
186
-            avcodec_get_pix_fmt_name(link->format),
186
+            av_pix_fmt_descriptors[link->format].name,
187 187
             link->src ? link->src->filter->name : "",
188 188
             link->dst ? link->dst->filter->name : "",
189 189
             end ? "\n" : "");
... ...
@@ -298,7 +299,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
298 298
 
299 299
     /* copy the slice if needed for permission reasons */
300 300
     if(link->srcpic) {
301
-        avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
301
+        hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
302
+        vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
302 303
 
303 304
         for(i = 0; i < 4; i ++) {
304 305
             if(link->srcpic->data[i]) {
... ...
@@ -24,6 +24,7 @@
24 24
  */
25 25
 
26 26
 #include "avfilter.h"
27
+#include "libavutil/pixdesc.h"
27 28
 #include "libswscale/swscale.h"
28 29
 
29 30
 typedef struct {
... ...
@@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink)
126 126
                                 SWS_BILINEAR, NULL, NULL, NULL);
127 127
 
128 128
     av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n",
129
-           outlink->w, outlink->h, avcodec_get_pix_fmt_name(outlink->format));
129
+           outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name);
130 130
 
131 131
     scale->input_is_pal = inlink->format == PIX_FMT_PAL8      ||
132 132
                           inlink->format == PIX_FMT_BGR4_BYTE ||
... ...
@@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
143 143
     AVFilterLink *outlink = link->dst->outputs[0];
144 144
     AVFilterPicRef *outpicref;
145 145
 
146
-    avcodec_get_chroma_sub_sample(link->format, &scale->hsub, &scale->vsub);
146
+    scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
147
+    scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
147 148
 
148 149
     outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
149 150
     outpicref->pts = picref->pts;
... ...
@@ -24,6 +24,7 @@
24 24
  */
25 25
 
26 26
 #include "avfilter.h"
27
+#include "libavutil/pixdesc.h"
27 28
 
28 29
 typedef struct {
29 30
     int h;          ///< output slice height
... ...
@@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
44 44
 static int config_props(AVFilterLink *link)
45 45
 {
46 46
     SliceContext *slice = link->dst->priv;
47
-    int tmp;
48 47
 
49
-    avcodec_get_chroma_sub_sample(link->format, &tmp, &slice->vshift);
48
+    slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h;
50 49
 
51 50
     /* ensure that slices play nice with chroma subsampling, and enforce
52 51
      * a reasonable minimum size for the slices */
... ...
@@ -23,6 +23,7 @@
23 23
  * video vertical flip filter
24 24
  */
25 25
 
26
+#include "libavutil/pixdesc.h"
26 27
 #include "avfilter.h"
27 28
 
28 29
 typedef struct {
... ...
@@ -32,9 +33,8 @@ typedef struct {
32 32
 static int config_input(AVFilterLink *link)
33 33
 {
34 34
     FlipContext *flip = link->dst->priv;
35
-    int tmp;
36 35
 
37
-    avcodec_get_chroma_sub_sample(link->format, &tmp, &flip->vsub);
36
+    flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
38 37
 
39 38
     return 0;
40 39
 }