diff options
author | wm4 <wm4@nowhere> | 2012-12-19 12:04:32 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-13 20:04:10 +0100 |
commit | ab94c64ed2d8b90bd7b0c348e79c2d8b8d055ee6 (patch) | |
tree | c58bbce7185bd003daad53472a8c49fafb4d769a /video/mp_image.h | |
parent | 00653a3eb0520e9d2409929cd217a5c299be2f5c (diff) | |
download | mpv-ab94c64ed2d8b90bd7b0c348e79c2d8b8d055ee6.tar.bz2 mpv-ab94c64ed2d8b90bd7b0c348e79c2d8b8d055ee6.tar.xz |
mp_image: simplify image allocation
mp_image_alloc_planes() allocated images with minimal stride, even if
the resulting stride was unaligned. It was the responsibility of
vf_get_image() to set an image's width to something larger than
required to get an aligned stride, and then crop it. Always allocate
with aligned strides instead.
Get rid of IMGFMT_IF09 special handling. This format is not used
anymore. (IF09 has 4x4 chroma sub-sampling, and that is what it was
mainly used for - this is still supported.) Get rid of swapped chroma
plane allocation. This is not used anywhere, and VOs like vo_xv,
vo_direct3d and vo_sdl do their own swapping.
Always round chroma width/height up instead of down. Consider 4:2:0 and
an uneven image size. For luma, the size was left uneven, and the chroma
size was rounded down. This doesn't make sense, because chroma would be
missing for the bottom/right border.
Remove mp_image_new_empty() and mp_image_alloc_planes(), they were not
used anymore, except in draw_bmp.c. (It's still allowed to setup
mp_images manually, you just can't allocate image data with them
anymore - this is also done in draw_bmp.c.)
Diffstat (limited to 'video/mp_image.h')
-rw-r--r-- | video/mp_image.h | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/video/mp_image.h b/video/mp_image.h index 3a86dc5fcd..cfc839c1cc 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -28,11 +28,7 @@ #include "csputils.h" #include "video/img_format.h" -// Minimum stride alignment in pixels -#define MP_STRIDE_ALIGNMENT 32 - -// set if buffer is allocated (used in destination images): -#define MP_IMGFLAG_ALLOCATED 0x4000 +#define MP_PALETTE_SIZE (256 * 4) #define MP_IMGFIELD_ORDERED 0x01 #define MP_IMGFIELD_TOP_FIRST 0x02 @@ -113,9 +109,7 @@ void mp_image_unrefp(struct mp_image **p_img); void mp_image_set_size(struct mp_image *mpi, int w, int h); void mp_image_set_display_size(struct mp_image *mpi, int dw, int dh); -struct mp_image *mp_image_new_empty(int w, int h); void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); -void mp_image_alloc_planes(struct mp_image *mpi); void mp_image_steal_data(struct mp_image *dst, struct mp_image *src); struct mp_image *mp_image_new_custom_ref(struct mp_image *img, void *arg, @@ -133,14 +127,4 @@ struct mp_csp_details; void mp_image_set_colorspace_details(struct mp_image *image, struct mp_csp_details *csp); -// this macro requires img_format.h to be included too: -#define MP_IMAGE_PLANAR_BITS_PER_PIXEL_ON_PLANE(mpi, p) \ - (IMGFMT_IS_YUVP16((mpi)->imgfmt) ? 16 : 8) -#define MP_IMAGE_BITS_PER_PIXEL_ON_PLANE(mpi, p) \ - (((mpi)->flags & MP_IMGFLAG_PLANAR) \ - ? MP_IMAGE_PLANAR_BITS_PER_PIXEL_ON_PLANE(mpi, p) \ - : (mpi)->bpp) -#define MP_IMAGE_BYTES_PER_ROW_ON_PLANE(mpi, p) \ - ((MP_IMAGE_BITS_PER_PIXEL_ON_PLANE(mpi, p) * ((mpi)->w >> (p ? mpi->chroma_x_shift : 0)) + 7) / 8) - #endif /* MPLAYER_MP_IMAGE_H */ |