Port recent changes to MPlayer libmpcodecs.

Also include an older fix for vf_smartblur which was essentially
broken due to reading the threshold value wrongly.
This commit is contained in:
Reimar Döffinger 2011-06-01 21:24:16 +02:00
parent 2a30df09fd
commit 3379531c40
5 changed files with 15 additions and 11 deletions

View File

@ -598,7 +598,8 @@ static void uninit(struct vf_instance *vf)
static int vf_open(vf_instance_t *vf, char *args) static int vf_open(vf_instance_t *vf, char *args)
{ {
struct vf_priv_s *p; struct vf_priv_s *p;
char *filename="framediff.log", *ap, *q, *a; const char *filename="framediff.log";
char *ap, *q, *a;
if(args && !(args=av_strdup(args))) if(args && !(args=av_strdup(args)))
{ {

View File

@ -28,6 +28,7 @@
#include "img_format.h" #include "img_format.h"
#include "mp_image.h" #include "mp_image.h"
#include "vf.h" #include "vf.h"
#include "libavutil/attributes.h"
typedef void (pack_func_t)(unsigned char *dst, unsigned char *y, typedef void (pack_func_t)(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs); unsigned char *u, unsigned char *v, int w, int us, int vs);
@ -38,7 +39,8 @@ struct vf_priv_s {
}; };
static void pack_nn_C(unsigned char *dst, unsigned char *y, static void pack_nn_C(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w) unsigned char *u, unsigned char *v, int w,
int av_unused us, int av_unused vs)
{ {
int j; int j;
for (j = w/2; j; j--) { for (j = w/2; j; j--) {
@ -77,7 +79,8 @@ static void pack_li_1_C(unsigned char *dst, unsigned char *y,
#if HAVE_MMX #if HAVE_MMX
static void pack_nn_MMX(unsigned char *dst, unsigned char *y, static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w) unsigned char *u, unsigned char *v, int w,
int av_unused us, int av_unused vs)
{ {
__asm__ volatile ("" __asm__ volatile (""
ASMALIGN(4) ASMALIGN(4)
@ -103,7 +106,7 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
: "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
: "memory" : "memory"
); );
pack_nn_C(dst, y, u, v, (w&7)); pack_nn_C(dst, y, u, v, (w&7), 0, 0);
} }
#if HAVE_EBX_AVAILABLE #if HAVE_EBX_AVAILABLE
@ -413,12 +416,12 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->priv->mode = 1; vf->priv->mode = 1;
if (args) sscanf(args, "%d", &vf->priv->mode); if (args) sscanf(args, "%d", &vf->priv->mode);
pack_nn = (pack_func_t *)pack_nn_C; pack_nn = pack_nn_C;
pack_li_0 = pack_li_0_C; pack_li_0 = pack_li_0_C;
pack_li_1 = pack_li_1_C; pack_li_1 = pack_li_1_C;
#if HAVE_MMX #if HAVE_MMX
if(gCpuCaps.hasMMX) { if(gCpuCaps.hasMMX) {
pack_nn = (pack_func_t *)pack_nn_MMX; pack_nn = pack_nn_MMX;
#if HAVE_EBX_AVAILABLE #if HAVE_EBX_AVAILABLE
pack_li_0 = pack_li_0_MMX; pack_li_0 = pack_li_0_MMX;
pack_li_1 = pack_li_1_MMX; pack_li_1 = pack_li_1_MMX;

View File

@ -286,8 +286,8 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
int x, y; int x, y;
const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
uint8_t *p_src= p->src + 8*stride; uint8_t *p_src= p->src + 8*stride;
DCTELEM *block= p->src; DCTELEM *block= (DCTELEM *)p->src;
DCTELEM *temp= p->src + 32; DCTELEM *temp= (DCTELEM *)(p->src + 32);
if (!src || !dst) return; // HACK avoid crash for Y8 colourspace if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
for(y=0; y<height; y++){ for(y=0; y<height; y++){

View File

@ -183,11 +183,11 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift; int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift; int ch= mpi->h >> mpi->chroma_y_shift;
FilterParam *f= &vf->priv; int threshold = vf->priv->luma.threshold || vf->priv->chroma.threshold;
mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE| MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|
(f->threshold) ? MP_IMGFLAG_READABLE : 0, (threshold ? MP_IMGFLAG_READABLE : 0),
mpi->w,mpi->h); mpi->w,mpi->h);
assert(mpi->flags&MP_IMGFLAG_PLANAR); assert(mpi->flags&MP_IMGFLAG_PLANAR);

View File

@ -132,7 +132,7 @@ static int config( struct vf_instance *vf,
int z, stepsX, stepsY; int z, stepsX, stepsY;
FilterParam *fp; FilterParam *fp;
char *effect; const char *effect;
// allocate buffers // allocate buffers