summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-04 18:16:36 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:31 +0100
commit23ab098969f5182585578ee01c3a47d42dea031f (patch)
tree3f9003095a8f8bb92ab61e8df9c51e109f4d4ffb /video/filter
parentcfa1f9e082f3da83adb5161be140e477b38bc5c7 (diff)
downloadmpv-23ab098969f5182585578ee01c3a47d42dea031f.tar.bz2
mpv-23ab098969f5182585578ee01c3a47d42dea031f.tar.xz
video: remove slice based filtering and video output
Slices allowed filtering or drawing video in horizontal bands or blocks. This allowed working on the video in smaller units. In theory, this could bring a performance win by lowering cache pressure, as you didn't have to keep the whole video frame in cache while filtering, only the slice. In practice, the slice code path was barely used for the following reasons: - Multithreaded decoding with ffmpeg didn't use slices. The ffmpeg slice callback was disabled, because it can be called from another thread, and the mplayer video chain is not thread-safe. - There was nothing that would turn "full" images into appropriate slices, so slices were rarely used. - Most filters didn't actually support slices. On the other hand, supporting slices lead to code duplication and more complex code in general. I made some experiments and didn't find any actual measurable performance improvements when using slices. Even ffmpeg removed slices based filtering from libavfilter in favor of simpler code. The most broken thing about the slices code path is that slices can't be queued, like it is done for images in vo.c.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf.c45
-rw-r--r--video/filter/vf.h5
-rw-r--r--video/filter/vf_crop.c45
-rw-r--r--video/filter/vf_dsize.c1
-rw-r--r--video/filter/vf_expand.c77
-rw-r--r--video/filter/vf_format.c1
-rw-r--r--video/filter/vf_noformat.c1
-rw-r--r--video/filter/vf_pullup.c1
-rw-r--r--video/filter/vf_rotate.c1
-rw-r--r--video/filter/vf_scale.c42
-rw-r--r--video/filter/vf_screenshot.c59
-rw-r--r--video/filter/vf_sub.c11
-rw-r--r--video/filter/vf_vo.c21
13 files changed, 9 insertions, 301 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index ce842868ef..417d5be1a3 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -260,11 +260,9 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
// keep buffer allocation status & color flags only:
mpi->flags &= MP_IMGFLAG_ALLOCATED | MP_IMGFLAG_TYPE_DISPLAYED |
MP_IMGFLAGMASK_COLORS;
- // accept restrictions, draw_slice and palette flags only:
+ // accept restrictions, palette flags only:
mpi->flags |= mp_imgflag & (MP_IMGFLAGMASK_RESTRICTIONS |
- MP_IMGFLAG_DRAW_CALLBACK | MP_IMGFLAG_RGB_PALETTE);
- if (!vf->draw_slice)
- mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
+ MP_IMGFLAG_RGB_PALETTE);
if (mpi->width != w2 || mpi->height != h || missing_palette) {
if (mpi->flags & MP_IMGFLAG_ALLOCATED) {
if (mpi->width < w2 || mpi->height < h || missing_palette) {
@@ -331,17 +329,13 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
vf_mpi_clear(mpi, 0, 0, mpi->width, mpi->height);
}
}
- if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
- if (vf->start_slice)
- vf->start_slice(vf, mpi);
if (!(mpi->flags & MP_IMGFLAG_TYPE_DISPLAYED)) {
mp_msg(MSGT_DECVIDEO, MSGL_V,
- "*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
+ "*** [%s] %s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
vf->info->name,
(mpi->type == MP_IMGTYPE_EXPORT) ? "Exporting" :
((mpi->flags & MP_IMGFLAG_DIRECT) ?
"Direct Rendering" : "Allocating"),
- (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) ? " (slices)" : "",
mpi->width, mpi->height, mpi->bpp,
(mpi->flags & MP_IMGFLAG_YUV) ? "YUV" :
((mpi->flags & MP_IMGFLAG_SWAPPED) ? "BGR" : "RGB"),
@@ -664,39 +658,6 @@ int vf_next_put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
return vf->next->put_image(vf->next, mpi, pts);
}
-void vf_next_draw_slice(struct vf_instance *vf, unsigned char **src,
- int *stride, int w, int h, int x, int y)
-{
- if (vf->next->draw_slice) {
- vf->next->draw_slice(vf->next, src, stride, w, h, x, y);
- return;
- }
- if (!vf->dmpi) {
- mp_msg(MSGT_VFILTER, MSGL_ERR,
- "draw_slice: dmpi not stored by vf_%s\n", vf->info->name);
- return;
- }
- if (!(vf->dmpi->flags & MP_IMGFLAG_PLANAR)) {
- memcpy_pic(vf->dmpi->planes[0] + y * vf->dmpi->stride[0] +
- vf->dmpi->bpp / 8 * x,
- src[0], vf->dmpi->bpp / 8 * w, h, vf->dmpi->stride[0],
- stride[0]);
- return;
- }
- memcpy_pic(vf->dmpi->planes[0] + y * vf->dmpi->stride[0] + x, src[0],
- w, h, vf->dmpi->stride[0], stride[0]);
- memcpy_pic(vf->dmpi->planes[1]
- + (y >> vf->dmpi->chroma_y_shift) * vf->dmpi->stride[1]
- + (x >> vf->dmpi->chroma_x_shift),
- src[1], w >> vf->dmpi->chroma_x_shift,
- h >> vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]);
- memcpy_pic(vf->dmpi->planes[2]
- + (y >> vf->dmpi->chroma_y_shift) * vf->dmpi->stride[2]
- + (x >> vf->dmpi->chroma_x_shift),
- src[2], w >> vf->dmpi->chroma_x_shift,
- h >> vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]);
-}
-
//============================================================================
vf_instance_t *append_filters(vf_instance_t *last,
diff --git a/video/filter/vf.h b/video/filter/vf.h
index f470bdc3b9..29727259ba 100644
--- a/video/filter/vf.h
+++ b/video/filter/vf.h
@@ -66,9 +66,6 @@ typedef struct vf_instance {
int (*query_format)(struct vf_instance *vf, unsigned int fmt);
void (*get_image)(struct vf_instance *vf, mp_image_t *mpi);
int (*put_image)(struct vf_instance *vf, mp_image_t *mpi, double pts);
- void (*start_slice)(struct vf_instance *vf, mp_image_t *mpi);
- void (*draw_slice)(struct vf_instance *vf, unsigned char **src,
- int *stride, int w, int h, int x, int y);
void (*uninit)(struct vf_instance *vf);
int (*continue_buffered_image)(struct vf_instance *vf);
@@ -141,8 +138,6 @@ int vf_next_config(struct vf_instance *vf,
int vf_next_control(struct vf_instance *vf, int request, void *data);
int vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
int vf_next_put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
-void vf_next_draw_slice(struct vf_instance *vf, unsigned char **src,
- int *stride, int w, int h, int x, int y);
struct m_obj_settings;
vf_instance_t *append_filters(vf_instance_t *last,
diff --git a/video/filter/vf_crop.c b/video/filter/vf_crop.c
index 86eb1d2140..ed3457da70 100644
--- a/video/filter/vf_crop.c
+++ b/video/filter/vf_crop.c
@@ -86,8 +86,6 @@ static int config(struct vf_instance *vf,
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
- if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)
- return vf_next_put_image(vf,vf->dmpi, pts);
dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0,
vf->priv->crop_w, vf->priv->crop_h);
@@ -111,54 +109,11 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void start_slice(struct vf_instance *vf, mp_image_t *mpi){
- vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags,
- vf->priv->crop_w, vf->priv->crop_h);
-}
-
-static void draw_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
- unsigned char *src2[3];
- src2[0] = src[0];
- if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) {
- src2[1] = src[1];
- src2[2] = src[2];
- }
- //mp_msg(MSGT_VFILTER, MSGL_V, "crop slice %d %d %d %d ->", w,h,x,y);
- if ((x -= vf->priv->crop_x) < 0) {
- x = -x;
- src2[0] += x;
- if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) {
- src2[1] += x>>vf->dmpi->chroma_x_shift;
- src2[2] += x>>vf->dmpi->chroma_x_shift;
- }
- w -= x;
- x = 0;
- }
- if ((y -= vf->priv->crop_y) < 0) {
- y = -y;
- src2[0] += y*stride[0];
- if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) {
- src2[1] += (y>>vf->dmpi->chroma_y_shift)*stride[1];
- src2[2] += (y>>vf->dmpi->chroma_y_shift)*stride[2];
- }
- h -= y;
- y = 0;
- }
- if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x;
- if (y+h > vf->priv->crop_h) h = vf->priv->crop_h-y;
- //mp_msg(MSGT_VFILTER, MSGL_V, "%d %d %d %d\n", w,h,x,y);
- if (w <= 0 || h <= 0) return;
- vf_next_draw_slice(vf,src2,stride,w,h,x,y);
-}
-
//===========================================================================//
static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->put_image=put_image;
- vf->start_slice=start_slice;
- vf->draw_slice=draw_slice;
vf->default_reqs=VFCAP_ACCEPT_STRIDE;
mp_msg(MSGT_VFILTER, MSGL_INFO, "Crop: %d x %d, %d ; %d\n",
vf->priv->crop_w,
diff --git a/video/filter/vf_dsize.c b/video/filter/vf_dsize.c
index e1c246135b..7df9feb127 100644
--- a/video/filter/vf_dsize.c
+++ b/video/filter/vf_dsize.c
@@ -84,7 +84,6 @@ static void uninit(vf_instance_t *vf) {
static int vf_open(vf_instance_t *vf, char *args)
{
vf->config = config;
- vf->draw_slice = vf_next_draw_slice;
vf->uninit = uninit;
//vf->default_caps = 0;
vf->priv = calloc(sizeof(struct vf_priv_s), 1);
diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c
index 7c9feb4375..3d1e3467f4 100644
--- a/video/filter/vf_expand.c
+++ b/video/filter/vf_expand.c
@@ -48,7 +48,6 @@ static struct vf_priv_s {
int exp_x,exp_y;
double aspect;
int round;
- int first_slice;
} const vf_priv_dflt = {
-1,-1,
-1,-1,
@@ -56,7 +55,6 @@ static struct vf_priv_s {
-1,-1,
0.,
1,
- 0
};
//===========================================================================//
@@ -141,11 +139,6 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){
mpi->type, mpi->flags,
FFMAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
FFMAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
- if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) &&
- !(vf->dmpi->flags & MP_IMGFLAG_DIRECT)){
- mp_tmsg(MSGT_VFILTER, MSGL_INFO, "Full DR not possible, trying SLICES instead!\n");
- return;
- }
// set up mpi as a cropped-down image of dmpi:
if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[0]=vf->dmpi->planes[0]+
@@ -164,73 +157,7 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){
mpi->stride[0]=vf->dmpi->stride[0];
mpi->width=vf->dmpi->width;
mpi->flags|=MP_IMGFLAG_DIRECT;
- mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
-// vf->dmpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
- }
-}
-
-static void start_slice(struct vf_instance *vf, mp_image_t *mpi){
-// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
- // they want slices!!! allocate the buffer.
- if(!mpi->priv)
- mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
-// MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- MP_IMGTYPE_TEMP, mpi->flags,
- FFMAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
- FFMAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
- vf->priv->first_slice = 1;
-}
-
-static void draw_top_blackbar_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
- if(vf->priv->exp_y>0 && y == 0) {
- vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
- vf->dmpi->w,vf->priv->exp_y,0,0);
- }
-
-}
-
-static void draw_bottom_blackbar_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
- if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h) {
- unsigned char *src2[MP_MAX_PLANES];
- src2[0] = vf->dmpi->planes[0]
- + (vf->priv->exp_y+vf->h)*vf->dmpi->stride[0];
- if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
- src2[1] = vf->dmpi->planes[1]
- + ((vf->priv->exp_y+vf->h)>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[1];
- src2[2] = vf->dmpi->planes[2]
- + ((vf->priv->exp_y+vf->h)>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[2];
- } else {
- src2[1] = vf->dmpi->planes[1]; // passthrough rgb8 palette
- }
- vf_next_draw_slice(vf, src2, vf->dmpi->stride,
- vf->dmpi->w,vf->dmpi->h-(vf->priv->exp_y+vf->h),
- 0,vf->priv->exp_y+vf->h);
- }
-}
-
-static void draw_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
-// printf("draw_slice() called %d at %d\n",h,y);
-
- if (y == 0 && y+h == vf->h) {
- // special case - only one slice
- draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
- vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
- draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
- return;
- }
- if (vf->priv->first_slice) {
- draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
- draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
- }
- vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
- if (!vf->priv->first_slice) {
- draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
- draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
}
- vf->priv->first_slice = 0;
}
// w, h = width and height of the actual video frame (located at exp_x/exp_y)
@@ -249,7 +176,7 @@ static void clear_borders(struct vf_instance *vf, int w, int h)
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
+ if(mpi->flags&MP_IMGFLAG_DIRECT){
vf->dmpi=mpi->priv;
if(!vf->dmpi) { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "Why do we get NULL??\n"); return 0; }
mpi->priv=NULL;
@@ -304,8 +231,6 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->control=control;
vf->query_format=query_format;
- vf->start_slice=start_slice;
- vf->draw_slice=draw_slice;
vf->get_image=get_image;
vf->put_image=put_image;
mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, aspect: %f, round: %d\n",
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index ca71bb0548..7e0ab634c4 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -58,7 +58,6 @@ static int config(struct vf_instance *vf, int width, int height,
static int vf_open(vf_instance_t *vf, char *args){
vf->query_format=query_format;
- vf->draw_slice=vf_next_draw_slice;
vf->default_caps=0;
if (vf->priv->outfmt)
vf->config=config;
diff --git a/video/filter/vf_noformat.c b/video/filter/vf_noformat.c
index 0da691fec2..032d11fd57 100644
--- a/video/filter/vf_noformat.c
+++ b/video/filter/vf_noformat.c
@@ -47,7 +47,6 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
static int vf_open(vf_instance_t *vf, char *args){
vf->query_format=query_format;
- vf->draw_slice=vf_next_draw_slice;
vf->default_caps=0;
return 1;
}
diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c
index c03d60341f..acac407429 100644
--- a/video/filter/vf_pullup.c
+++ b/video/filter/vf_pullup.c
@@ -99,7 +99,6 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi)
mpi->stride[2] = c->stride[2];
mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
}
#endif
diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c
index a59ddbc310..8994cf4588 100644
--- a/video/filter/vf_rotate.c
+++ b/video/filter/vf_rotate.c
@@ -76,7 +76,6 @@ static int config(struct vf_instance *vf,
}
if (vf->priv->direction & 4){
vf->put_image=vf_next_put_image; // passthru mode!
- if (vf->next->draw_slice) vf->draw_slice=vf_next_draw_slice;
/* FIXME: this should be in an other procedure in vf.c; that should always check
whether the filter after the passthrough one still (not)supports slices */
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c
index 76423dbda9..5749aa0baf 100644
--- a/video/filter/vf_scale.c
+++ b/video/filter/vf_scale.c
@@ -47,7 +47,6 @@ static struct vf_priv_s {
double param[2];
unsigned int fmt;
struct SwsContext *ctx;
- struct SwsContext *ctx2; //for interlaced slices only
unsigned char* palette;
int interlaced;
int noup;
@@ -60,7 +59,6 @@ static struct vf_priv_s {
{SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT},
0,
NULL,
- NULL,
NULL
};
@@ -301,7 +299,6 @@ static int config(struct vf_instance *vf,
// free old ctx:
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
- if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2);
// new swscaler:
sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter);
@@ -312,13 +309,6 @@ static int config(struct vf_instance *vf,
vf->priv->w, vf->priv->h >> vf->priv->interlaced,
dfmt,
int_sws_flags, srcFilter, dstFilter, vf->priv->param);
- if(vf->priv->interlaced){
- vf->priv->ctx2=sws_getContext(width, height >> 1,
- sfmt,
- vf->priv->w, vf->priv->h >> 1,
- dfmt,
- int_sws_flags, srcFilter, dstFilter, vf->priv->param);
- }
if(!vf->priv->ctx){
// error...
mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n");
@@ -388,16 +378,6 @@ static int config(struct vf_instance *vf,
return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
}
-static void start_slice(struct vf_instance *vf, mp_image_t *mpi){
-// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
- if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
- // they want slices!!! allocate the buffer.
- mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt,
-// mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- vf->priv->w, vf->priv->h);
-}
-
static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES],
int y, int h, uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){
const uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2], src[3]};
@@ -428,24 +408,13 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src
}
}
-static void draw_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
- mp_image_t *dmpi=vf->dmpi;
- if(!dmpi){
- mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n");
- return;
- }
-// printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
- scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
-}
-
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi=mpi->priv;
// printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
// dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
- if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
+ if(!dmpi){
// hope we'll get DR buffer:
dmpi=vf_get_image(vf->next,vf->priv->fmt,
@@ -512,17 +481,11 @@ static int control(struct vf_instance *vf, int request, void* data){
r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
if(r<0) break;
- if(vf->priv->ctx2){
- r= sws_setColorspaceDetails(vf->priv->ctx2, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
- if(r<0) break;
- }
return CONTROL_TRUE;
case VFCTRL_SET_YUV_COLORSPACE: {
struct mp_csp_details colorspace = *(struct mp_csp_details *)data;
if (mp_sws_set_colorspace(vf->priv->ctx, &colorspace) >= 0) {
- if (vf->priv->ctx2)
- mp_sws_set_colorspace(vf->priv->ctx2, &colorspace);
vf->priv->colorspace = colorspace;
return 1;
}
@@ -619,15 +582,12 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
static void uninit(struct vf_instance *vf){
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
- if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2);
free(vf->priv->palette);
free(vf->priv);
}
static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
- vf->start_slice=start_slice;
- vf->draw_slice=draw_slice;
vf->put_image=put_image;
vf->query_format=query_format;
vf->control= control;
diff --git a/video/filter/vf_screenshot.c b/video/filter/vf_screenshot.c
index bb5ca517a0..29d2e0b1e0 100644
--- a/video/filter/vf_screenshot.c
+++ b/video/filter/vf_screenshot.c
@@ -37,7 +37,7 @@ struct vf_priv_s {
mp_image_t *image;
void (*image_callback)(void *, mp_image_t *);
void *image_callback_ctx;
- int shot, store_slices;
+ int shot;
};
//===========================================================================//
@@ -54,53 +54,8 @@ static int config(struct vf_instance *vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
-{
- mpi->priv=
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags, mpi->width, mpi->height);
- if (vf->priv->shot) {
- vf->priv->store_slices = 1;
- if (!(vf->priv->image->flags & MP_IMGFLAG_ALLOCATED))
- mp_image_alloc_planes(vf->priv->image);
- }
-
-}
-
-static void memcpy_pic_slice(unsigned char *dst, unsigned char *src,
- int bytesPerLine, int y, int h,
- int dstStride, int srcStride)
-{
- memcpy_pic(dst + h * dstStride, src + h * srcStride, bytesPerLine,
- h, dstStride, srcStride);
-}
-
-static void draw_slice(struct vf_instance *vf, unsigned char** src,
- int* stride, int w,int h, int x, int y)
-{
- if (vf->priv->store_slices) {
- mp_image_t *dst = vf->priv->image;
- int bp = (dst->bpp + 7) / 8;
-
- if (dst->flags & MP_IMGFLAG_PLANAR) {
- int bytes_per_line[3] = { w * bp, dst->chroma_width, dst->chroma_width };
- for (int n = 0; n < 3; n++) {
- memcpy_pic_slice(dst->planes[n], src[n], bytes_per_line[n],
- y, h, dst->stride[n], stride[n]);
- }
- } else {
- memcpy_pic_slice(dst->planes[0], src[0], dst->w*bp, y, dst->h,
- dst->stride[0], stride[0]);
- }
- }
- vf_next_draw_slice(vf,src,stride,w,h,x,y);
-}
-
static void get_image(struct vf_instance *vf, mp_image_t *mpi)
{
- // FIXME: should vf.c really call get_image when using slices??
- if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
- return;
vf->dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height);
@@ -119,7 +74,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi = (mp_image_t *)mpi->priv;
- if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
+ if(!(mpi->flags&(MP_IMGFLAG_DIRECT))){
dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0,
mpi->width, mpi->height);
@@ -134,11 +89,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
if(vf->priv->shot) {
vf->priv->shot=0;
- mp_image_t image;
- if (!vf->priv->store_slices)
- image = *dmpi;
- else
- image = *vf->priv->image;
+ mp_image_t image = *dmpi;
image.flags &= ~MP_IMGFLAG_ALLOCATED;
image.w = vf->priv->image->w;
image.h = vf->priv->image->h;
@@ -146,7 +97,6 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
image.display_w = vf->priv->image->display_w;
image.display_h = vf->priv->image->display_h;
vf->priv->image_callback(vf->priv->image_callback_ctx, &image);
- vf->priv->store_slices = 0;
}
return vf_next_put_image(vf, dmpi, pts);
@@ -188,13 +138,10 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->control=control;
vf->put_image=put_image;
vf->query_format=query_format;
- vf->start_slice=start_slice;
- vf->draw_slice=draw_slice;
vf->get_image=get_image;
vf->uninit=uninit;
vf->priv=malloc(sizeof(struct vf_priv_s));
vf->priv->shot=0;
- vf->priv->store_slices=0;
vf->priv->image=NULL;
return 1;
}
diff --git a/video/filter/vf_sub.c b/video/filter/vf_sub.c
index 5b2a79a030..3307af0c90 100644
--- a/video/filter/vf_sub.c
+++ b/video/filter/vf_sub.c
@@ -104,12 +104,6 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi)
FFMAX(mpi->width, vf->priv->outw),
FFMAX(mpi->height, vf->priv->outh));
- if ((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) &&
- !(vf->dmpi->flags & MP_IMGFLAG_DIRECT)) {
- mp_tmsg(MSGT_ASS, MSGL_INFO, "Full DR not possible, trying SLICES instead!\n");
- return;
- }
-
int tmargin = vf->priv->opt_top_margin;
// set up mpi as a cropped-down image of dmpi:
if (mpi->flags & MP_IMGFLAG_PLANAR) {
@@ -124,8 +118,6 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi)
mpi->stride[0] = vf->dmpi->stride[0];
mpi->width = vf->dmpi->width;
mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
-// vf->dmpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
}
static void blank(mp_image_t *mpi, int y1, int y2)
@@ -155,8 +147,7 @@ static void blank(mp_image_t *mpi, int y1, int y2)
static int prepare_image(struct vf_instance *vf, mp_image_t *mpi)
{
int tmargin = vf->priv->opt_top_margin;
- if (mpi->flags & MP_IMGFLAG_DIRECT
- || mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) {
+ if (mpi->flags & MP_IMGFLAG_DIRECT) {
vf->dmpi = mpi->priv;
if (!vf->dmpi) {
mp_tmsg(MSGT_ASS, MSGL_WARN, "Why do we get NULL??\n");
diff --git a/video/filter/vf_vo.c b/video/filter/vf_vo.c
index 8fe30bf415..b8eb7bb13d 100644
--- a/video/filter/vf_vo.c
+++ b/video/filter/vf_vo.c
@@ -37,9 +37,6 @@ struct vf_priv_s {
};
#define video_out (vf->priv->vo)
-static void draw_slice(struct vf_instance *vf, unsigned char **src,
- int *stride, int w, int h, int x, int y);
-
static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
@@ -69,7 +66,6 @@ static int config(struct vf_instance *vf,
// save vo's stride capability for the wanted colorspace:
vf->default_caps = video_out->default_caps;
- vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
return 1;
}
@@ -140,21 +136,6 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
return vo_draw_image(video_out, mpi, pts);
}
-static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
-{
- if (!video_out->config_ok)
- return;
- vo_control(video_out, VOCTRL_START_SLICE, mpi);
-}
-
-static void draw_slice(struct vf_instance *vf, unsigned char **src,
- int *stride, int w, int h, int x, int y)
-{
- if (!video_out->config_ok)
- return;
- vo_draw_slice(video_out, src, stride, w, h, x, y);
-}
-
static void uninit(struct vf_instance *vf)
{
if (vf->priv) {
@@ -172,8 +153,6 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->query_format = query_format;
vf->get_image = get_image;
vf->put_image = put_image;
- vf->draw_slice = draw_slice;
- vf->start_slice = start_slice;
vf->uninit = uninit;
vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->vo = (struct vo *)args;