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

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