History

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 committed 16 years ago

Commit b4b66451 parent 971c55f4 files · +12 −8Browse files

Unified · Split

4 files
  1. libavfilter/avfilter.c +4 −2
  2. libavfilter/vf_scale.c +4 −2
  3. libavfilter/vf_slicify.c +2 −2
  4. libavfilter/vf_vflip.c +2 −2
libavfilter/avfilter.c+4−2
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 /* #define DEBUG */
2323
2424 #include "libavcodec/imgconvert.h"
25+#include "libavutil/pixdesc.h"
2526 #include "avfilter.h"
2627
2728 unsigned avfilter_version(void) {
@@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end) · 155 unmodified lines
183184 dprintf(ctx,
184185 "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
185186 link, link->w, link->h,
186− avcodec_get_pix_fmt_name(link->format),
187+ av_pix_fmt_descriptors[link->format].name,
187188 link->src ? link->src->filter->name : "",
188189 link->dst ? link->dst->filter->name : "",
189190 end ? "\n" : "");
@@ -298,7 +299,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 108 unmodified lines
298299
299300 /* copy the slice if needed for permission reasons */
300301 if(link->srcpic) {
301− avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
302+ hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
303+ vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
302304
303305 for(i = 0; i < 4; i ++) {
304306 if(link->srcpic->data[i]) {
libavfilter/vf_scale.c+4−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 */
2525
2626 #include "avfilter.h"
27+#include "libavutil/pixdesc.h"
2728 #include "libswscale/swscale.h"
2829
2930 typedef struct {
@@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink) · 96 unmodified lines
126127 SWS_BILINEAR, NULL, NULL, NULL);
127128
128129 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));
130+ outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name);
130131
131132 scale->input_is_pal = inlink->format == PIX_FMT_PAL8 ||
132133 inlink->format == PIX_FMT_BGR4_BYTE ||
@@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) · 10 unmodified lines
143144 AVFilterLink *outlink = link->dst->outputs[0];
144145 AVFilterPicRef *outpicref;
145146
146− avcodec_get_chroma_sub_sample(link->format, &scale->hsub, &scale->vsub);
147+ scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
148+ scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
147149
148150 outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
149151 outpicref->pts = picref->pts;
libavfilter/vf_slicify.c+2−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 */
2525
2626 #include "avfilter.h"
27+#include "libavutil/pixdesc.h"
2728
2829 typedef struct {
2930 int h; ///< output slice height
@@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) · 14 unmodified lines
4445 static int config_props(AVFilterLink *link)
4546 {
4647 SliceContext *slice = link->dst->priv;
47− int tmp;
4848
49− avcodec_get_chroma_sub_sample(link->format, &tmp, &slice->vshift);
49+ slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h;
5050
5151 /* ensure that slices play nice with chroma subsampling, and enforce
5252 * a reasonable minimum size for the slices */
libavfilter/vf_vflip.c+2−2
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 * video vertical flip filter
2424 */
2525
26+#include "libavutil/pixdesc.h"
2627 #include "avfilter.h"
2728
2829 typedef struct {
@@ -32,9 +33,8 @@ typedef struct { · 3 unmodified lines
3233 static int config_input(AVFilterLink *link)
3334 {
3435 FlipContext *flip = link->dst->priv;
35− int tmp;
3636
37− avcodec_get_chroma_sub_sample(link->format, &tmp, &flip->vsub);
37+ flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
3838
3939 return 0;
4040 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t