You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avfilter: use the getters for xGA font data arrays
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -1038,7 +1038,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t color
|
||||
int font_height;
|
||||
int i;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (i = 0; txt[i]; i++) {
|
||||
int char_y, mask;
|
||||
|
@ -655,6 +655,7 @@ fail:
|
||||
static int render_default_font(AVFrame *tmp)
|
||||
{
|
||||
const char *str = "EF G A BC D ";
|
||||
const uint8_t *vga16_font = avpriv_vga16_font_get();
|
||||
int x, u, v, mask;
|
||||
uint8_t *data = tmp->data[0];
|
||||
int linesize = tmp->linesize[0];
|
||||
@ -666,7 +667,7 @@ static int render_default_font(AVFrame *tmp)
|
||||
for (v = 0; v < height; v++) {
|
||||
uint8_t *p = startptr + v * linesize + height/2 * 4 * u;
|
||||
for (mask = 0x80; mask; mask >>= 1, p += 4) {
|
||||
if (mask & avpriv_vga16_font[str[u] * 16 + v])
|
||||
if (mask & vga16_font[str[u] * 16 + v])
|
||||
p[3] = 255;
|
||||
else
|
||||
p[3] = 0;
|
||||
|
@ -492,7 +492,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
|
||||
const uint8_t *font;
|
||||
int font_height;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (int i = 0; txt[i]; i++) {
|
||||
int char_y, mask;
|
||||
|
@ -225,7 +225,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
|
||||
int font_height;
|
||||
int i;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (i = 0; txt[i]; i++) {
|
||||
int char_y, mask;
|
||||
|
@ -246,8 +246,8 @@ static void drawtext(AVFrame *pic, int x, int y, int ftid, const uint8_t *color,
|
||||
int font_height;
|
||||
va_list vl;
|
||||
|
||||
if (ftid == FONT16) font = avpriv_vga16_font, font_height = 16;
|
||||
else if (ftid == FONT8) font = avpriv_cga_font, font_height = 8;
|
||||
if (ftid == FONT16) font = avpriv_vga16_font_get(), font_height = 16;
|
||||
else if (ftid == FONT8) font = avpriv_cga_font_get(), font_height = 8;
|
||||
else return;
|
||||
|
||||
va_start(vl, fmt);
|
||||
|
@ -186,7 +186,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt,
|
||||
int font_height;
|
||||
int i;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
if (y + 8 >= pic->height ||
|
||||
x + len * 8 >= pic->width)
|
||||
|
@ -252,6 +252,7 @@ static int audio_frame(AVFilterLink *outlink)
|
||||
static void draw_text(FFDrawContext *draw, AVFrame *out, FFDrawColor *color,
|
||||
int x0, int y0, const uint8_t *text)
|
||||
{
|
||||
const uint8_t *cga_font = avpriv_cga_font_get();
|
||||
int x = x0;
|
||||
|
||||
for (; *text; text++) {
|
||||
@ -262,7 +263,7 @@ static void draw_text(FFDrawContext *draw, AVFrame *out, FFDrawColor *color,
|
||||
}
|
||||
ff_blend_mask(draw, color, out->data, out->linesize,
|
||||
out->width, out->height,
|
||||
avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0);
|
||||
&cga_font[*text * 8], 1, 8, 8, 0, 0, x, y0);
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ static int query_formats(const AVFilterContext *ctx,
|
||||
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color,
|
||||
int x0, int y0, const uint8_t *text, int vertical)
|
||||
{
|
||||
const uint8_t *cga_font = avpriv_cga_font_get();
|
||||
int x = x0;
|
||||
|
||||
for (; *text; text++) {
|
||||
@ -98,7 +99,7 @@ static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color,
|
||||
}
|
||||
ff_blend_mask(draw, color, frame->data, frame->linesize,
|
||||
frame->width, frame->height,
|
||||
avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0);
|
||||
&cga_font[*text * 8], 1, 8, 8, 0, 0, x, y0);
|
||||
if (vertical) {
|
||||
x = x0;
|
||||
y0 += 8;
|
||||
|
@ -968,7 +968,7 @@ static void draw_ihtext(AVFrame *out, int x, int y, float o1, float o2, const ch
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -993,7 +993,7 @@ static void draw_ihtext16(AVFrame *out, int x, int y, float o1, float o2, const
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -1019,7 +1019,7 @@ static void draw_htext(AVFrame *out, int x, int y, float o1, float o2, const cha
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -1045,7 +1045,7 @@ static void draw_htext16(AVFrame *out, int x, int y, float o1, float o2, const c
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
|
@ -2635,7 +2635,7 @@ static void draw_htext(AVFrame *out, int x, int y, int mult, float o1, float o2,
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2661,7 +2661,7 @@ static void draw_htext16(AVFrame *out, int x, int y, int mult, float o1, float o
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2687,7 +2687,7 @@ static void draw_vtext(AVFrame *out, int x, int y, int mult, float o1, float o2,
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2712,7 +2712,7 @@ static void draw_vtext16(AVFrame *out, int x, int y, int mult, float o1, float o
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2779,7 +2779,7 @@ static void idraw_htext(AVFrame *out, int x, int y, int mult, float o1, float o2
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2805,7 +2805,7 @@ static void idraw_htext16(AVFrame *out, int x, int y, int mult, float o1, float
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2831,7 +2831,7 @@ static void idraw_vtext(AVFrame *out, int x, int y, int mult, float o1, float o2
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
@ -2856,7 +2856,7 @@ static void idraw_vtext16(AVFrame *out, int x, int y, int mult, float o1, float
|
||||
int font_height;
|
||||
int i, plane;
|
||||
|
||||
font = avpriv_cga_font, font_height = 8;
|
||||
font = avpriv_cga_font_get(), font_height = 8;
|
||||
|
||||
for (plane = 0; plane < 4 && out->data[plane]; plane++) {
|
||||
for (i = 0; txt[i]; i++) {
|
||||
|
@ -733,6 +733,7 @@ static uint32_t color_gradient(unsigned index)
|
||||
static void draw_text(TestSourceContext *s, AVFrame *frame, FFDrawColor *color,
|
||||
int x0, int y0, const uint8_t *text)
|
||||
{
|
||||
const uint8_t *vga16_font = avpriv_vga16_font_get();
|
||||
int x = x0;
|
||||
|
||||
for (; *text; text++) {
|
||||
@ -743,7 +744,7 @@ static void draw_text(TestSourceContext *s, AVFrame *frame, FFDrawColor *color,
|
||||
}
|
||||
ff_blend_mask(&s->draw, color, frame->data, frame->linesize,
|
||||
frame->width, frame->height,
|
||||
avpriv_vga16_font + *text * 16, 1, 8, 16, 0, 0, x, y0);
|
||||
&vga16_font[*text * 16], 1, 8, 16, 0, 0, x, y0);
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user