Commit Graph

10 Commits

Author SHA1 Message Date
wm4 65b313a8b0 draw_bmp, csputils: use function instead of macro 2012-10-28 15:31:32 +01:00
wm4 18d4eebedb draw_bmp: cosmetics, refactor
Mostly pedantic bikeshedding issues.

Move some code around, so that the sub_bitmap_to_mp_images() function
can be split into two parts. This is better than having a big function
with many input and outputs, of which only half are used in each code
path.

Also, try to make code simpler by using a mp_rect type.
2012-10-28 15:31:31 +01:00
wm4 f50d0b16e0 draw_bmp: remove CONDITIONAL2 code
This was sometimes slower, sometimes slightly faster. Remove it.
2012-10-24 23:12:26 +02:00
wm4 2afd7ebb4e options: remove subtitle related options that did nothing
Most of these cased working when the OSD was switched to libass, or
didn't do anything even before that.

Also don't recursively include subreader.h in sub.h.
2012-10-24 21:56:35 +02:00
Rudolf Polzer e1e056fe5d draw_bmp: fix IMGFMT_BGR32 use 2012-10-24 21:56:35 +02:00
wm4 4b4e4b5690 draw_bmp: fix for yuy2 format
mp_get_chroma_shift() modifies its argument even if it fails, so we have
to restore that.

mp_image didn't set chroma shifts for yuy2.
2012-10-24 21:56:34 +02:00
wm4 a4f9077f6c draw_bmp: don't try to call swscale if image format not supported
If that happens, we silently fail.
2012-10-24 21:56:34 +02:00
wm4 bf68634d15 sub: add cache to mp_draw_sub_bitmaps()
This caches scaled RGBA sub-bitmaps.
2012-10-24 21:56:34 +02:00
wm4 0e72b0d5d3 draw_bmp: compensate for libswscale writing past image bounds
libswscale tends to overwrite the area between (w,y)-(0,y+1). It tries
to process multiple pixels at once, and if the memory past the last x
pixel is inside a SIMD operation, but still below the image stride, it
overwrites that data with black.

This happens with vo_x11 and 32 bit RGBA formats. The bug is visible as
black bar right of the subtitle bounding box. Fix by giving libswscale
more alignment. Then the "outside" pixels are inside, and are processed
normally instead of overwritten with black.

NOTE: we do not increase the alignment constant, because this is a
separate issue from pointer alignment. libavutil's av_malloc() wouldn't
actually satisfy the increased alignment either.
2012-10-24 21:56:33 +02:00
Rudolf Polzer aa1047a35a sub: add helper to draw sub-bitmaps into an image
Merged by wm4 from commits 93978f17b76d..13211ef5fc20. Changed copyright
header in draw_bmp.c to "mpv", and removed the one in draw_bmp.h.
2012-10-24 21:56:29 +02:00