diff options
33 files changed, 23 insertions, 499 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 271978786d..5265968269 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -937,7 +937,7 @@ :8: macroblock (MB) type :16: per-block quantization parameter (QP) :32: motion vector - :0x0040: motion vector visualization (use ``--no-slices``) + :0x0040: motion vector visualization :0x0080: macroblock (MB) skip :0x0100: startcode :0x0200: PTS @@ -1759,12 +1759,6 @@ This affects smplayer, smplayer2, mplayerosx, and others. ---slices, --no-slices - Drawing video by 16-pixel height slices/bands, instead draws the - whole frame in a single run. May be faster or slower, depending on video - card and available cache. It has effect only with libavcodec codecs. - Enabled by default if applicable; usually disabled when threading is used. - --softsleep Time frames by repeatedly checking the current time instead of asking the kernel to wake up mpv at the correct time. Useful if your kernel diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index cbe705ebc4..a13eae243f 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -482,8 +482,6 @@ const m_option_t common_opts[] = { OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1), - // draw by slices or whole frame (useful with libmpeg2/libavcodec) - OPT_MAKE_FLAGS("slices", vd_use_slices, 0), // use (probably completely broken) decoder direct rendering OPT_MAKE_FLAGS("dr1", vd_use_dr1, 0), {"field-dominance", &field_dominance, CONF_TYPE_CHOICE, 0, diff --git a/core/options.h b/core/options.h index fbeb94c042..d6bac625df 100644 --- a/core/options.h +++ b/core/options.h @@ -108,7 +108,6 @@ typedef struct MPOpts { float movie_aspect; float screen_size_xy; int flip; - int vd_use_slices; int vd_use_dr1; char **sub_name; char **sub_paths; diff --git a/video/decode/vd.c b/video/decode/vd.c index 6112c48d33..89783da189 100644 --- a/video/decode/vd.c +++ b/video/decode/vd.c @@ -261,12 +261,3 @@ mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, { return vf_get_image(sh->vfilter, sh->outfmt, mp_imgtype, mp_imgflag, w, h); } - -void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride, - int w, int h, int x, int y) -{ - struct vf_instance *vf = sh->vfilter; - - if (vf->draw_slice) - vf->draw_slice(vf, src, stride, w, h, x, y); -} diff --git a/video/decode/vd.h b/video/decode/vd.h index 2495a22dc3..838e5ad123 100644 --- a/video/decode/vd.h +++ b/video/decode/vd.h @@ -54,7 +54,5 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); -void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride, - int w, int h, int x, int y); #endif /* MPLAYER_VD_H */ diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 4d548c0fa0..2f661dfdd1 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -66,7 +66,6 @@ typedef struct { AVCodecContext *avctx; AVFrame *pic; enum PixelFormat pix_fmt; - int do_slices; int do_dr1; int vo_initialized; int best_csp; @@ -83,8 +82,6 @@ typedef struct { static int get_buffer(AVCodecContext *avctx, AVFrame *pic); static void release_buffer(AVCodecContext *avctx, AVFrame *pic); -static void draw_slice(struct AVCodecContext *s, const AVFrame *src, - int offset[4], int y, int type, int height); static void draw_slice_hwdec(struct AVCodecContext *s, const AVFrame *src, int offset[4], int y, int type, int height); @@ -169,11 +166,6 @@ static int init(sh_video_t *sh) if (!sh->codecname) sh->codecname = lavc_codec->name; - if (sh->opts->vd_use_slices - && (lavc_codec->capabilities & CODEC_CAP_DRAW_HORIZ_BAND) - && !do_vis_debug) - ctx->do_slices = 1; - if (lavc_codec->capabilities & CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO @@ -192,7 +184,6 @@ static int init(sh_video_t *sh) if (lavc_codec->capabilities & CODEC_CAP_HWACCEL // XvMC || lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) { ctx->do_dr1 = true; - ctx->do_slices = true; lavc_param->threads = 1; avctx->get_format = get_format; avctx->get_buffer = get_buffer; @@ -219,7 +210,6 @@ static int init(sh_video_t *sh) * from other threads. */ if (lavc_param->threads > 1) { ctx->do_dr1 = false; - ctx->do_slices = false; mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Asking decoder to use " "%d threads if supported.\n", lavc_param->threads); } @@ -384,34 +374,6 @@ static void draw_slice_hwdec(struct AVCodecContext *s, vf->control(vf, VFCTRL_HWDEC_DECODER_RENDER, state_ptr); } -static void draw_slice(struct AVCodecContext *s, - const AVFrame *src, int offset[4], - int y, int type, int height) -{ - sh_video_t *sh = s->opaque; - uint8_t *source[MP_MAX_PLANES] = { - src->data[0] + offset[0], src->data[1] + offset[1], - src->data[2] + offset[2] - }; - int strides[MP_MAX_PLANES] = { - src->linesize[0], src->linesize[1], src->linesize[2] - }; - if (height < 0) { - int i; - height = -height; - y -= height; - for (i = 0; i < MP_MAX_PLANES; i++) { - strides[i] = -strides[i]; - source[i] -= strides[i]; - } - } - if (y < sh->disp_h) { - height = FFMIN(height, sh->disp_h - y); - mpcodecs_draw_slice(sh, source, strides, sh->disp_w, height, 0, y); - } -} - - static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt) { vd_ffmpeg_ctx *ctx = sh->context; @@ -498,17 +460,14 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic) type = MP_IMGTYPE_STATIC; flags |= MP_IMGFLAG_PRESERVE; } - flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0; mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n"); } else { if (!pic->reference) { ctx->b_count++; - flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0; } else { ctx->ip_count++; - flags |= MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE - | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); + flags |= MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE; } } @@ -549,16 +508,6 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic) if (!mpi) return -1; - // ok, let's see what did we get: - if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK && - !(mpi->flags & MP_IMGFLAG_DIRECT)) { - // nice, filter/vo likes draw_callback :) - avctx->draw_horiz_band = draw_slice; - } else - avctx->draw_horiz_band = NULL; - if (IMGFMT_IS_HWACCEL(mpi->imgfmt)) - avctx->draw_horiz_band = draw_slice_hwdec; - pic->data[0] = mpi->planes[0]; pic->data[1] = mpi->planes[1]; pic->data[2] = mpi->planes[2]; 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/ |