Files
Hubert Głuchowski 2007f5543c sub/sd_sbr: use instanced rendering to avoid blending in software
The instanced API allows a lot of work to be offloaded to the GPU and
makes software rasterization tolerable performance-wise in most cases.

This is similar to sd_ass but there are some substantial differences:
- It uses a BGRA atlas to allow drawing bitmap emoji.
- De-duplicates images internally to significantly reduce atlas size by
  reusing the same atlas image for different instances.
- Exploits bilinear interpolation to further reduce atlas size of some
  primitives. For example this allows reducing background boxes to one
  very stretched pixel.

Bumps subrandr requirement to `v1.1` since this API is not present in
earlier versions.
2026-01-14 01:56:18 +01:00

45 lines
1.5 KiB
C

/*
* Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MP_SUB_PACKER_H
#define MP_SUB_PACKER_H
#include <stdbool.h>
#include "config.h"
#include <ass/ass.h>
#include <ass/ass_types.h>
struct sub_bitmaps;
struct mp_sub_packer;
struct mp_sub_packer *mp_sub_packer_alloc(void *ta_parent);
void mp_sub_packer_pack_ass(struct mp_sub_packer *p, ASS_Image **image_lists,
int num_image_lists, bool changed, bool video_color_space,
int preferred_osd_format, struct sub_bitmaps *out);
#if HAVE_SUBRANDR
struct sbr_instanced_raster_pass;
void mp_sub_packer_pack_sbr(struct mp_sub_packer *p, struct sbr_instanced_raster_pass *pass,
struct sub_bitmaps *out);
const struct sub_bitmaps *mp_sub_packer_get_cached(struct mp_sub_packer *p);
#endif
#endif