From 51befc9debef818cbf071aebf8861457ac095f8d Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Mar 2015 12:33:14 +0100 Subject: osd: simplify an aspect of change detection handling There was a somewhat obscure optimization in the OSD and subtitle rendering path: if only the position of the sub-images changed, and not the actual image data, uploading of the image data could be skipped. In theory, this could speed up things like scrolling subtitles. But it turns out that even in the rare cases subtitles have such scrolls or axis-aligned movement, modern libass rarely signals this kind of change. Possibly this is because of sub-pixel handling and such, which break this. As such, it's a worthless optimization and just introduces additional complexity and subtle bugs (especially in cases libass does the opposite: incorrectly signaling a position change only, which happened before). Remove this optimization, and rename bitmap_pos_id to change_id. --- sub/draw_bmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sub/draw_bmp.c') diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index c5c0dddd29..d9cb0522df 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -43,7 +43,7 @@ struct sub_cache { }; struct part { - int bitmap_pos_id; + int change_id; int imgfmt; enum mp_csp colorspace; enum mp_csp_levels levels; @@ -399,7 +399,7 @@ static struct part *get_cache(struct mp_draw_sub_cache *cache, if (use_cache) { part = cache->parts[sbs->render_index]; if (part) { - if (part->bitmap_pos_id != sbs->bitmap_pos_id + if (part->change_id != sbs->change_id || part->imgfmt != format->imgfmt || part->colorspace != format->params.colorspace || part->levels != format->params.colorlevels) @@ -411,7 +411,7 @@ static struct part *get_cache(struct mp_draw_sub_cache *cache, if (!part) { part = talloc(cache, struct part); *part = (struct part) { - .bitmap_pos_id = sbs->bitmap_pos_id, + .change_id = sbs->change_id, .num_imgs = sbs->num_parts, .imgfmt = format->imgfmt, .levels = format->params.colorlevels, -- cgit v1.2.3