summaryrefslogtreecommitdiffstats
path: root/sub/draw_bmp.c
Commit message (Collapse)AuthorAgeFilesLines
* video: add support for 12 and 14 bit YUV pixel formatsStephen Hutchinson2012-12-031-0/+8
| | | | | | | | | | | | Based on a patch by qyot27. Add the missing parts in mp_get_chroma_shift(), which allow allocation of such images, and which make vo_opengl automatically accept the new formats. Change the IMGFMT_IS_YUVP16_LE/BE macros to properly report IMGFMT_444P14 as supported: this pixel format has the highest numerical bit width identifier (0x55), which is not covered by the mask ~0xfc. Remove 1 bit from the mask (makes it 0xf8) so that IMGFMT_IS_YUVP16(IMGFMT_444P14) is 1. This is slightly risky, as the organization of the image format IDs (actually FourCCs + mplayer internal IDs) is messy at best, but it should be ok.
* draw_bmp: add RGB rendering to fix image quality issueswm42012-11-221-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out in commit ed01df, the quality loss due to frequent conversion between RGB and YUV is too much when drawing OSD and subtitles. Fix this by staying in the same colorspace when drawing subtitles. Render directly to RGB, without converting to YUV first. The bad thing about packed RGB is that there are many pixel formats, which would all require special code for blending. It's also completely incompatible to planar YUV. Use planar RGB instead, which allows us to reuse all code originally written for planar YUV. The only thing that needs to be changed is the color conversion in the libass case. (In exchange for simpler code, the image has to be copied, but this is still much better than converting to YUV.) Unfortunately, libswscale doesn't support planar RGB output. Add a hack to sws_utils.c to handle conversion to planar RGB. In the common case, when converting 32 bit per pixel RGB, calling swscale can be avoided entirely. The change in mp_image.c is needed to allocate GBRP images correctly. (The issue with vo_x11 could be easily solved by always backing up the same bounding box as the bitmap drawing RGB<->YUV conversion does, but this commit is probably the better fix.)
* vo_xv: don't require frame stepping to remove OSD or subswm42012-11-211-0/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to improve performance, vo_xv didn't create a backup of the video frame before drawing OSD and subtitles during normal playback. It required the frontend to do frame stepping if it wanted to redraw the OSD, but no backup of the video frame was available. (Consider the following use case: enable the OSD permanently with --osd-level=3, then pause during playback and do something that shows an OSD message. The player will advance the video by one frame at the time the new OSD message is first drawn.) This also meant that taking a screenshot during playback with vo_xv would include OSD and subtitles in the resulting image. Fix this by always creating a backup before drawing OSD or subtitles. In order to avoid having to create a full copy of the whole image frame, introduce a complex scheme that tries to backup only the changed regions. It's unclear whether the additional complexity in draw_bmp.c for backing up only the changed areas of the frame is worth it. Possibly a simpler implementation would suffice, such as tracking only Y ranges of changed image data, or even just copying the full frame. vo_xv's get_screenshot() now always creates a copy in order not to modify the currently displayed frame.
* Rename directories, move files (step 2 of 2)wm42012-11-121-5/+5
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* draw_bmp: remove swscale bug workaroundwm42012-11-011-3/+1
| | | | | ffmpeg ticket #1852 is fixed with 425c30dda. This didn't actually happen in practice.
* screenshot, draw_bmp: use colorspace passed with mp_imagewm42012-11-011-25/+48
| | | | | Remove the explicit struct mp_csp_details parameters from all related functions, and use mp_image.colorspace/levels instead.
* csputils: better support for integer color valueswm42012-10-281-1/+3
|
* draw_bmp, csputils: use function instead of macrowm42012-10-281-21/+4
|
* draw_bmp: cosmetics, refactorwm42012-10-281-420/+318
| | | | | | | | | | | 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.
* draw_bmp: remove CONDITIONAL2 codewm42012-10-241-25/+0
| | | | This was sometimes slower, sometimes slightly faster. Remove it.
* options: remove subtitle related options that did nothingwm42012-10-241-0/+1
| | | | | | | 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.
* draw_bmp: fix IMGFMT_BGR32 useRudolf Polzer2012-10-241-9/+15
|
* draw_bmp: fix for yuy2 formatwm42012-10-241-1/+2
| | | | | | | 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.
* draw_bmp: don't try to call swscale if image format not supportedwm42012-10-241-0/+3
| | | | If that happens, we silently fail.
* sub: add cache to mp_draw_sub_bitmaps()wm42012-10-241-9/+68
| | | | This caches scaled RGBA sub-bitmaps.
* draw_bmp: compensate for libswscale writing past image boundswm42012-10-241-1/+2
| | | | | | | | | | | | | | | | 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.
* sub: add helper to draw sub-bitmaps into an imageRudolf Polzer2012-10-241-0/+580
Merged by wm4 from commits 93978f17b76d..13211ef5fc20. Changed copyright header in draw_bmp.c to "mpv", and removed the one in draw_bmp.h.