video: remove things related to old DR code

Remove mp_image.width/height. The w/h members are the ones to use.
width/height were used internally by vf_get_image(), and sometimes for
other purposes.

Remove some image flags, most of which are now useless or completely
unused. This includes VFCAP_ACCEPT_STRIDE: the vf_expand insertion in
vf.c does nothing.

Remove some other unused mp_image fields.

Some rather messy changes in vo_opengl[_old] to get rid of legacy
mp_image flags and fields. This is left from when vo_gl supported DR.
This commit is contained in:
wm4 2012-12-12 23:55:41 +01:00
parent c54fc507da
commit 1b9d4a771a
14 changed files with 91 additions and 180 deletions

View File

@ -127,24 +127,16 @@ void vf_mpi_clear(mp_image_t *mpi, int x0, int y0, int w, int h)
if (mpi->flags & MP_IMGFLAG_PLANAR) {
y0 &= ~1;
h += h & 1;
if (x0 == 0 && w == mpi->width) {
// full width clear:
memset(mpi->planes[0] + mpi->stride[0] * y0, 0, mpi->stride[0] * h);
memset(mpi->planes[1] + mpi->stride[1] *(y0 >> mpi->chroma_y_shift),
128, mpi->stride[1] * (h >> mpi->chroma_y_shift));
memset(mpi->planes[2] + mpi->stride[2] *(y0 >> mpi->chroma_y_shift),
128, mpi->stride[2] * (h >> mpi->chroma_y_shift));
} else
for (y = y0; y < y0 + h; y += 2) {
memset(mpi->planes[0] + x0 + mpi->stride[0] * y, 0, w);
memset(mpi->planes[0] + x0 + mpi->stride[0] * (y + 1), 0, w);
memset(mpi->planes[1] + (x0 >> mpi->chroma_x_shift) +
mpi->stride[1] * (y >> mpi->chroma_y_shift),
128, (w >> mpi->chroma_x_shift));
memset(mpi->planes[2] + (x0 >> mpi->chroma_x_shift) +
mpi->stride[2] * (y >> mpi->chroma_y_shift),
128, (w >> mpi->chroma_x_shift));
}
for (y = y0; y < y0 + h; y += 2) {
memset(mpi->planes[0] + x0 + mpi->stride[0] * y, 0, w);
memset(mpi->planes[0] + x0 + mpi->stride[0] * (y + 1), 0, w);
memset(mpi->planes[1] + (x0 >> mpi->chroma_x_shift) +
mpi->stride[1] * (y >> mpi->chroma_y_shift),
128, (w >> mpi->chroma_x_shift));
memset(mpi->planes[2] + (x0 >> mpi->chroma_x_shift) +
mpi->stride[2] * (y >> mpi->chroma_y_shift),
128, (w >> mpi->chroma_x_shift));
}
return;
}
// packed:
@ -378,7 +370,7 @@ void vf_clone_mpi_attributes(mp_image_t *dst, mp_image_t *src)
dst->fields = src->fields;
dst->qscale_type = src->qscale_type;
dst->pts = src->pts;
if (dst->width == src->width && dst->height == src->height) {
if (dst->w == src->w && dst->h == src->h) {
dst->qstride = src->qstride;
dst->qscale = src->qscale;
dst->display_w = src->display_w;

View File

@ -188,7 +188,7 @@ static int filter(struct vf_instance *vf, struct mp_image *mpi)
set_imgprop(&vf->priv->filter.inpic, mpi);
if (mpi->qscale) {
if (mpi->qscale_type != 0) {
k = mpi->qstride * ((mpi->height + 15) >> 4);
k = mpi->qstride * ((mpi->h + 15) >> 4);
if (vf->priv->qbuffersize != k) {
vf->priv->qbuffer = realloc(vf->priv->qbuffer, k);
vf->priv->qbuffersize = k;

View File

@ -40,14 +40,14 @@ static int config(struct vf_instance *vf,
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
{
mpi->planes[0]=mpi->planes[0]+
mpi->stride[0]*(mpi->height-1);
mpi->stride[0]*(mpi->h-1);
mpi->stride[0]=-mpi->stride[0];
if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[1]=mpi->planes[1]+
mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1);
mpi->stride[1]*((mpi->h>>mpi->chroma_y_shift)-1);
mpi->stride[1]=-mpi->stride[1];
mpi->planes[2]=mpi->planes[2]+
mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1);
mpi->stride[2]*((mpi->h>>mpi->chroma_y_shift)-1);
mpi->stride[2]=-mpi->stride[2];
}
return mpi;

View File

@ -150,7 +150,7 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->filter=filter;
vf->uninit=uninit;
vf->default_caps=VFCAP_ACCEPT_STRIDE|VFCAP_POSTPROC;
vf->default_caps=VFCAP_POSTPROC;
vf->priv=malloc(sizeof(struct vf_priv_s));
vf->priv->context=NULL;

View File

@ -58,7 +58,7 @@ static void init_pullup(struct vf_instance *vf, mp_image_t *mpi)
c->h[1] = c->h[2] = mpi->chroma_height;
c->w[3] = ((mpi->w+15)/16) * ((mpi->h+15)/16);
c->h[3] = 2;
c->stride[0] = mpi->width;
c->stride[0] = mpi->w;
c->stride[1] = c->stride[2] = mpi->chroma_width;
c->stride[3] = c->w[3];
c->background[1] = c->background[2] = 128;

View File

@ -113,12 +113,7 @@ static int control(struct vf_instance *vf, int request, void *data)
static int query_format(struct vf_instance *vf, unsigned int fmt)
{
int flags = video_out->driver->query_format(video_out, fmt);
// draw_slice() accepts stride, draw_frame() doesn't:
if (flags)
if (fmt == IMGFMT_YV12 || fmt == IMGFMT_I420 || fmt == IMGFMT_IYUV)
flags |= VFCAP_ACCEPT_STRIDE;
return flags;
return video_out->driver->query_format(video_out, fmt);
}
static void uninit(struct vf_instance *vf)

View File

@ -100,10 +100,10 @@ void mp_image_alloc_planes(mp_image_t *mpi) {
assert(!mpi->refcount);
// IF09 - allocate space for 4. plane delta info - unused
if (mpi->imgfmt == IMGFMT_IF09) {
mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8+
mpi->planes[0]=av_malloc(mpi->bpp*mpi->w*(mpi->h+2)/8+
mpi->chroma_width*mpi->chroma_height);
} else
mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8);
mpi->planes[0]=av_malloc(mpi->bpp*mpi->w*(mpi->h+2)/8);
if (!mpi->planes[0])
abort(); //out of memory
if (mpi->flags&MP_IMGFLAG_PLANAR) {
@ -111,18 +111,18 @@ void mp_image_alloc_planes(mp_image_t *mpi) {
// by 8. Currently the case for all planar formats.
int bpp = MP_IMAGE_PLANAR_BITS_PER_PIXEL_ON_PLANE(mpi, 0) / 8;
// YV12/I420/YVU9/IF09. feel free to add other planar formats here...
mpi->stride[0]=mpi->stride[3]=bpp*mpi->width;
mpi->stride[0]=mpi->stride[3]=bpp*mpi->w;
if(mpi->num_planes > 2){
mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width;
if(mpi->flags&MP_IMGFLAG_SWAPPED){
// I420/IYUV (Y,U,V)
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->h;
mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height;
if (mpi->num_planes > 3)
mpi->planes[3]=mpi->planes[2]+mpi->stride[2]*mpi->chroma_height;
} else {
// YV12,YVU9,IF09 (Y,V,U)
mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height;
mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->h;
mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height;
if (mpi->num_planes > 3)
mpi->planes[3]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height;
@ -130,10 +130,10 @@ void mp_image_alloc_planes(mp_image_t *mpi) {
} else {
// NV12/NV21
mpi->stride[1]=mpi->chroma_width;
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->h;
}
} else {
mpi->stride[0]=mpi->width*mpi->bpp/8;
mpi->stride[0]=mpi->w*mpi->bpp/8;
if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
mpi->planes[1] = av_malloc(1024);
}
@ -196,16 +196,16 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags|=MP_IMGFLAG_PLANAR;
mpi->chroma_x_shift = 0;
mpi->chroma_y_shift = 0;
mpi->chroma_width=mpi->width;
mpi->chroma_height=mpi->height;
mpi->chroma_width=mpi->w;
mpi->chroma_height=mpi->h;
return;
}
mpi->flags|=MP_IMGFLAG_YUV;
if (mp_get_chroma_shift(out_fmt, NULL, NULL, NULL)) {
mpi->flags|=MP_IMGFLAG_PLANAR;
mpi->bpp = mp_get_chroma_shift(out_fmt, &mpi->chroma_x_shift, &mpi->chroma_y_shift, NULL);
mpi->chroma_width = mpi->width >> mpi->chroma_x_shift;
mpi->chroma_height = mpi->height >> mpi->chroma_y_shift;
mpi->chroma_width = mpi->w >> mpi->chroma_x_shift;
mpi->chroma_height = mpi->h >> mpi->chroma_y_shift;
}
switch(out_fmt){
case IMGFMT_I420:
@ -265,8 +265,8 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
case IMGFMT_YUY2:
mpi->chroma_x_shift = 1;
mpi->chroma_y_shift = 1;
mpi->chroma_width=(mpi->width>>1);
mpi->chroma_height=(mpi->height>>1);
mpi->chroma_width=(mpi->w>>1);
mpi->chroma_height=(mpi->h>>1);
mpi->bpp=16;
mpi->num_planes=1;
return;
@ -276,8 +276,8 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags|=MP_IMGFLAG_PLANAR;
mpi->bpp=12;
mpi->num_planes=2;
mpi->chroma_width=(mpi->width>>0);
mpi->chroma_height=(mpi->height>>1);
mpi->chroma_width=(mpi->w>>0);
mpi->chroma_height=(mpi->h>>1);
mpi->chroma_x_shift=0;
mpi->chroma_y_shift=1;
return;
@ -316,8 +316,8 @@ struct mp_image *mp_image_new_empty(int w, int h)
// Caller has to make sure this doesn't exceed the allocated plane data/strides.
void mp_image_set_size(struct mp_image *mpi, int w, int h)
{
mpi->w = mpi->width = w;
mpi->h = mpi->height = h;
mpi->w = w;
mpi->h = h;
mpi->chroma_width = mpi->w >> mpi->chroma_x_shift;
mpi->chroma_height = mpi->h >> mpi->chroma_y_shift;
mpi->display_w = mpi->display_h = 0;
@ -333,10 +333,10 @@ struct mp_image *mp_image_alloc(unsigned int imgfmt, int w, int h)
{
struct mp_image *mpi = mp_image_new_empty(w, h);
mpi->width = FFALIGN(w, MP_STRIDE_ALIGNMENT);
mpi->w = FFALIGN(w, MP_STRIDE_ALIGNMENT);
mp_image_setfmt(mpi, imgfmt);
mp_image_alloc_planes(mpi);
mpi->width = w;
mpi->w = w;
mp_image_setfmt(mpi, imgfmt); // reset chroma size
mpi->flags &= ~MP_IMGFLAG_ALLOCATED;

View File

@ -30,38 +30,6 @@
// Minimum stride alignment in pixels
#define MP_STRIDE_ALIGNMENT 32
//--------- codec's requirements (filled by the codec/vf) ---------
//--- buffer content restrictions:
// set if buffer content shouldn't be modified:
#define MP_IMGFLAG_PRESERVE 0x01
// set if buffer content will be READ.
// This can be e.g. for next frame's MC: (I/P mpeg frames) -
// then in combination with MP_IMGFLAG_PRESERVE - or it
// can be because a video filter or codec will read a significant
// amount of data while processing that frame (e.g. blending something
// onto the frame, MV based intra prediction).
// A frame marked like this should not be placed in to uncachable
// video RAM for example.
#define MP_IMGFLAG_READABLE 0x02
//--- buffer width/stride/plane restrictions: (used for direct rendering)
// stride _have_to_ be aligned to MB boundary: [for DR restrictions]
#define MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE 0x4
// stride should be aligned to MB boundary: [for buffer allocation]
#define MP_IMGFLAG_PREFER_ALIGNED_STRIDE 0x8
// codec accept any stride (>=width):
#define MP_IMGFLAG_ACCEPT_STRIDE 0x10
// codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width):
#define MP_IMGFLAG_ACCEPT_WIDTH 0x20
//--- for planar formats only:
// uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift
#define MP_IMGFLAG_COMMON_STRIDE 0x40
// uses only planes[0], and calculates planes[1,2] from width,height,imgfmt
#define MP_IMGFLAG_COMMON_PLANE 0x80
#define MP_IMGFLAGMASK_RESTRICTIONS 0xFF
//--------- color info (filled by mp_image_setfmt() ) -----------
// set if number of planes > 1
#define MP_IMGFLAG_PLANAR 0x100
@ -72,30 +40,10 @@
// set if you want memory for palette allocated and managed by vf_get_image etc.
#define MP_IMGFLAG_RGB_PALETTE 0x800
#define MP_IMGFLAGMASK_COLORS 0xF00
// set if it's in video buffer/memory: [set by vo/vf's get_image() !!!]
#define MP_IMGFLAG_DIRECT 0x2000
// set if buffer is allocated (used in destination images):
#define MP_IMGFLAG_ALLOCATED 0x4000
// buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!)
#define MP_IMGFLAG_TYPE_DISPLAYED 0x8000
// codec doesn't support any form of direct rendering - it has own buffer
// allocation. so we just export its buffer pointers:
#define MP_IMGTYPE_EXPORT 0
// codec requires a static WO buffer, but it does only partial updates later:
#define MP_IMGTYPE_STATIC 1
// codec just needs some WO memory, where it writes/copies the whole frame to:
#define MP_IMGTYPE_TEMP 2
// I+P type, requires 2+ independent static R/W buffers
#define MP_IMGTYPE_IP 3
// I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers
#define MP_IMGTYPE_IPB 4
// Upper 16 bits give desired buffer number, -1 means get next available
#define MP_IMGTYPE_NUMBERED 5
#define MP_MAX_PLANES 4
#define MP_IMGFIELD_ORDERED 0x01
@ -123,10 +71,8 @@
*/
typedef struct mp_image {
unsigned int flags;
unsigned char type;
unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8
unsigned int imgfmt;
int width,height; // internal to vf.c, do not use (stored dimensions)
int w,h; // visible dimensions
int display_w,display_h; // if set (!= 0), anamorphic size
uint8_t *planes[MP_MAX_PLANES];
@ -147,9 +93,8 @@ typedef struct mp_image {
/* only inside filter chain */
double pts;
/* memory management */
int number, usage_count;
struct m_refcount *refcount;
/* for private use by filter or vo driver (to store buffer id or dmpi) */
/* for private use */
void* priv;
} mp_image_t;

View File

@ -1237,29 +1237,23 @@ static void flip_page(struct vo *vo)
p->frames_rendered++;
}
static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
static bool get_image(struct vo *vo, mp_image_t *mpi)
{
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
if (!p->use_pbo)
return VO_FALSE;
return false;
// We don't support alpha planes. (Disabling PBOs with normal draw calls is
// an undesired, but harmless side-effect.)
if (mpi->num_planes != p->plane_count)
return VO_FALSE;
return false;
if (mpi->flags & MP_IMGFLAG_READABLE)
return VO_FALSE;
if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP &&
(mpi->type != MP_IMGTYPE_NUMBERED || mpi->number))
return VO_FALSE;
mpi->flags &= ~MP_IMGFLAG_COMMON_PLANE;
for (int n = 0; n < p->plane_count; n++) {
struct texplane *plane = &p->planes[n];
mpi->stride[n] = (mpi->width >> plane->shift_x) * p->plane_bytes;
int needed_size = (mpi->height >> plane->shift_y) * mpi->stride[n];
mpi->stride[n] = (mpi->w >> plane->shift_x) * p->plane_bytes;
int needed_size = (mpi->h >> plane->shift_y) * mpi->stride[n];
if (!plane->gl_buffer)
gl->GenBuffers(1, &plane->gl_buffer);
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, plane->gl_buffer);
@ -1274,8 +1268,7 @@ static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
mpi->planes[n] = plane->buffer_ptr;
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
mpi->flags |= MP_IMGFLAG_DIRECT;
return VO_TRUE;
return true;
}
static void draw_image(struct vo *vo, mp_image_t *mpi)
@ -1288,14 +1281,8 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
mp_image_t mpi2 = *mpi;
int w = mpi->w, h = mpi->h;
mpi2.flags = 0;
mpi2.type = MP_IMGTYPE_TEMP;
mpi2.width = mpi2.w;
mpi2.height = mpi2.h;
if (!(mpi->flags & MP_IMGFLAG_DIRECT)
&& !p->planes[0].buffer_ptr
&& get_image(p->vo, &mpi2) == VO_TRUE)
{
bool pbo = false;
if (!p->planes[0].buffer_ptr && get_image(p->vo, &mpi2)) {
for (n = 0; n < p->plane_count; n++) {
struct texplane *plane = &p->planes[n];
int xs = plane->shift_x, ys = plane->shift_y;
@ -1304,13 +1291,14 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
mpi2.stride[n], mpi->stride[n]);
}
mpi = &mpi2;
pbo = true;
}
p->mpi_flipped = mpi->stride[0] < 0;
for (n = 0; n < p->plane_count; n++) {
struct texplane *plane = &p->planes[n];
int xs = plane->shift_x, ys = plane->shift_y;
void *plane_ptr = mpi->planes[n];
if (mpi->flags & MP_IMGFLAG_DIRECT) {
if (pbo) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, plane->gl_buffer);
if (!gl->UnmapBuffer(GL_PIXEL_UNPACK_BUFFER))
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Video PBO upload failed. "
@ -1638,7 +1626,7 @@ static bool init_format(int fmt, struct gl_priv *init)
static int query_format(struct vo *vo, uint32_t format)
{
int caps = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIP |
VFCAP_ACCEPT_STRIDE | VFCAP_OSD;
VFCAP_OSD;
if (!init_format(format, NULL))
return 0;
return caps;

View File

@ -587,30 +587,28 @@ static void flip_page(struct vo *vo)
gl->Clear(GL_COLOR_BUFFER_BIT);
}
static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
static bool get_image(struct vo *vo, mp_image_t *mpi, int *th, bool *cplane)
{
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
bool common_plane = false;
int needed_size;
if (!gl->GenBuffers || !gl->BindBuffer || !gl->BufferData || !gl->MapBuffer) {
if (!p->err_shown)
mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n"
"Expect a _major_ speed penalty\n");
p->err_shown = 1;
return VO_FALSE;
return false;
}
if (mpi->flags & MP_IMGFLAG_READABLE)
return VO_FALSE;
if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP &&
(mpi->type != MP_IMGTYPE_NUMBERED || mpi->number))
return VO_FALSE;
int width = mpi->w, height = mpi->h;
if (p->ati_hack) {
mpi->width = p->texture_width;
mpi->height = p->texture_height;
width = p->texture_width;
height = p->texture_height;
}
mpi->stride[0] = mpi->width * mpi->bpp / 8;
needed_size = mpi->stride[0] * mpi->height;
mpi->stride[0] = width * mpi->bpp / 8;
needed_size = mpi->stride[0] * height;
if (!p->buffer)
gl->GenBuffers(1, &p->buffer);
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, p->buffer);
@ -628,24 +626,24 @@ static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
mp_msg(MSGT_VO, MSGL_ERR, "[gl] could not acquire buffer for dr\n"
"Expect a _major_ speed penalty\n");
p->err_shown = 1;
return VO_FALSE;
return false;
}
if (p->is_yuv) {
// planar YUV
int xs, ys, component_bits;
mp_get_chroma_shift(p->image_format, &xs, &ys, &component_bits);
int bp = (component_bits + 7) / 8;
mpi->flags |= MP_IMGFLAG_COMMON_STRIDE | MP_IMGFLAG_COMMON_PLANE;
mpi->stride[0] = mpi->width * bp;
mpi->planes[1] = mpi->planes[0] + mpi->stride[0] * mpi->height;
mpi->stride[1] = (mpi->width >> xs) * bp;
mpi->planes[2] = mpi->planes[1] + mpi->stride[1] * (mpi->height >> ys);
mpi->stride[2] = (mpi->width >> xs) * bp;
common_plane = true;
mpi->stride[0] = width * bp;
mpi->planes[1] = mpi->planes[0] + mpi->stride[0] * height;
mpi->stride[1] = (width >> xs) * bp;
mpi->planes[2] = mpi->planes[1] + mpi->stride[1] * (height >> ys);
mpi->stride[2] = (width >> xs) * bp;
if (p->ati_hack) {
mpi->flags &= ~MP_IMGFLAG_COMMON_PLANE;
common_plane = false;
if (!p->buffer_uv[0])
gl->GenBuffers(2, p->buffer_uv);
int buffer_size = mpi->stride[1] * mpi->height;
int buffer_size = mpi->stride[1] * height;
if (buffer_size > p->buffersize_uv) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, p->buffer_uv[0]);
gl->BufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, NULL,
@ -667,8 +665,9 @@ static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
mpi->planes[2] = p->bufferptr_uv[1];
}
}
mpi->flags |= MP_IMGFLAG_DIRECT;
return VO_TRUE;
*th = height;
*cplane = common_plane;
return true;
}
static void clear_border(struct vo *vo, uint8_t *dst, int start, int stride,
@ -696,12 +695,12 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
unsigned char *planes[3];
mp_image_t mpi2 = *mpi;
int w = mpi->w, h = mpi->h;
int th = h;
bool common_plane = false;
bool pbo = false;
mpi2.flags = 0;
mpi2.type = MP_IMGTYPE_TEMP;
mpi2.width = mpi2.w;
mpi2.height = mpi2.h;
if (p->force_pbo && !(mpi->flags & MP_IMGFLAG_DIRECT) && !p->bufferptr
&& get_image(vo, &mpi2) == VO_TRUE)
if (p->force_pbo && !p->bufferptr
&& get_image(vo, &mpi2, &th, &common_plane))
{
int bp = mpi->bpp / 8;
int xs, ys, component_bits;
@ -720,16 +719,17 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
if (p->ati_hack) {
// since we have to do a full upload we need to clear the borders
clear_border(vo, mpi2.planes[0], mpi->w * bp, mpi2.stride[0],
mpi->h, mpi2.height, 0);
mpi->h, th, 0);
if (p->is_yuv) {
int clear = get_chroma_clear_val(component_bits);
clear_border(vo, mpi2.planes[1], uv_bytes, mpi2.stride[1],
mpi->h >> ys, mpi2.height >> ys, clear);
mpi->h >> ys, th >> ys, clear);
clear_border(vo, mpi2.planes[2], uv_bytes, mpi2.stride[2],
mpi->h >> ys, mpi2.height >> ys, clear);
mpi->h >> ys, th >> ys, clear);
}
}
mpi = &mpi2;
pbo = true;
}
stride[0] = mpi->stride[0];
stride[1] = mpi->stride[1];
@ -738,7 +738,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
planes[1] = mpi->planes[1];
planes[2] = mpi->planes[2];
p->mpi_flipped = stride[0] < 0;
if (mpi->flags & MP_IMGFLAG_DIRECT) {
if (pbo) {
intptr_t base = (intptr_t)planes[0];
if (p->ati_hack) {
w = p->texture_width;
@ -752,7 +752,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, p->buffer);
gl->UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
p->bufferptr = NULL;
if (!(mpi->flags & MP_IMGFLAG_COMMON_PLANE))
if (!common_plane)
planes[0] = planes[1] = planes[2] = NULL;
slice = 0; // always "upload" full texture
}
@ -761,7 +761,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
if (p->is_yuv) {
int xs, ys;
mp_get_chroma_shift(p->image_format, &xs, &ys, NULL);
if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) {
if (pbo && !common_plane) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, p->buffer_uv[0]);
gl->UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
p->bufferptr_uv[0] = NULL;
@ -769,7 +769,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
gl->ActiveTexture(GL_TEXTURE1);
glUploadTex(gl, p->target, p->gl_format, p->gl_type, planes[1],
stride[1], 0, 0, w >> xs, h >> ys, slice);
if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) {
if (pbo && !common_plane) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, p->buffer_uv[1]);
gl->UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
p->bufferptr_uv[1] = NULL;
@ -779,7 +779,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
stride[2], 0, 0, w >> xs, h >> ys, slice);
gl->ActiveTexture(GL_TEXTURE0);
}
if (mpi->flags & MP_IMGFLAG_DIRECT) {
if (pbo) {
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
@ -819,8 +819,7 @@ static int query_format(struct vo *vo, uint32_t format)
struct gl_priv *p = vo->priv;
int depth;
int caps = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIP |
VFCAP_ACCEPT_STRIDE;
int caps = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIP;
if (p->use_osd)
caps |= VFCAP_OSD;
if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)

View File

@ -814,8 +814,7 @@ static int query_format(struct vo *vo, uint32_t format)
{
struct priv *vc = vo->priv;
int i, j;
int cap = VFCAP_CSP_SUPPORTED | VFCAP_FLIP | VFCAP_ACCEPT_STRIDE |
VFCAP_OSD;
int cap = VFCAP_CSP_SUPPORTED | VFCAP_FLIP | VFCAP_OSD;
for (i = 0; i < vc->renderer_info.num_texture_formats; ++i)
for (j = 0; j < sizeof(formats) / sizeof(formats[0]); ++j)
if (vc->renderer_info.texture_formats[i] == formats[j].sdl)
@ -941,8 +940,7 @@ static void update_screeninfo(struct vo *vo)
static struct mp_image *get_screenshot(struct vo *vo)
{
struct priv *vc = vo->priv;
mp_image_t *image = alloc_mpi(vc->ssmpi->width, vc->ssmpi->height,
vc->ssmpi->imgfmt);
mp_image_t *image = alloc_mpi(vc->ssmpi->w, vc->ssmpi->h, vc->ssmpi->imgfmt);
copy_mpi(image, vc->ssmpi);
return image;
}

View File

@ -530,20 +530,17 @@ static int query_format(struct vo *vo, uint32_t format)
return 0; // TODO 8bpp not yet fully implemented
if (IMGFMT_BGR_DEPTH(format) == vo->x11->depthonscreen)
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
VFCAP_OSD | VFCAP_FLIP |
VFCAP_ACCEPT_STRIDE;
VFCAP_OSD | VFCAP_FLIP;
else
return VFCAP_CSP_SUPPORTED | VFCAP_OSD |
VFCAP_FLIP |
VFCAP_ACCEPT_STRIDE;
VFCAP_FLIP;
}
switch (format) {
case IMGFMT_I420:
case IMGFMT_IYUV:
case IMGFMT_YV12:
return VFCAP_CSP_SUPPORTED | VFCAP_OSD |
VFCAP_ACCEPT_STRIDE;
return VFCAP_CSP_SUPPORTED | VFCAP_OSD;
}
return 0;
}

View File

@ -418,7 +418,7 @@ static int query_format(struct vo *vo, uint32_t format)
{
struct xvctx *ctx = vo->priv;
uint32_t i;
int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN
int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD;
/* check image formats */
for (i = 0; i < ctx->formats; i++) {

View File

@ -31,9 +31,6 @@
// driver/hardware handles timing (blocking)
#define VFCAP_TIMER 0x100
// vf filter: accepts stride (put_image)
// vo driver: has draw_slice() support for the given csp
#define VFCAP_ACCEPT_STRIDE 0x400
// filter does postprocessing (so you shouldn't scale/filter image before it)
#define VFCAP_POSTPROC 0x800