[FFmpeg-cvslog] avfilter: use the getters for xGA font data arrays

James Almer git at videolan.org
Tue Jul 22 15:52:42 EEST 2025


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Jul 21 21:39:16 2025 -0300| [da18c2a373d1c11ba37773d6441efd59e60e3c7e] | committer: James Almer

avfilter: use the getters for xGA font data arrays

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da18c2a373d1c11ba37773d6441efd59e60e3c7e
---

 libavfilter/af_aiir.c          |  2 +-
 libavfilter/avf_showcqt.c      |  3 ++-
 libavfilter/avf_showspectrum.c |  2 +-
 libavfilter/avf_showvolume.c   |  2 +-
 libavfilter/f_ebur128.c        |  4 ++--
 libavfilter/f_graphmonitor.c   |  2 +-
 libavfilter/src_avsynctest.c   |  3 ++-
 libavfilter/vf_datascope.c     |  3 ++-
 libavfilter/vf_vectorscope.c   |  8 ++++----
 libavfilter/vf_waveform.c      | 16 ++++++++--------
 libavfilter/vsrc_testsrc.c     |  3 ++-
 11 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 9a43235ad6..f18b6e9286 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -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;
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 8ff6ecbe09..5050f46e25 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -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;
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index dc608c450a..ee71d55894 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -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;
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index e760caad2d..8472e86a15 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -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;
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 63669b71de..a352f3831f 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -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);
diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c
index de9946586c..20cdcce79d 100644
--- a/libavfilter/f_graphmonitor.c
+++ b/libavfilter/f_graphmonitor.c
@@ -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)
diff --git a/libavfilter/src_avsynctest.c b/libavfilter/src_avsynctest.c
index 68dffba43a..9c71a9fee8 100644
--- a/libavfilter/src_avsynctest.c
+++ b/libavfilter/src_avsynctest.c
@@ -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;
     }
 }
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 6efeb875a6..87137cee83 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -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;
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index 2143f9dcc2..eeee166172 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -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++) {
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 6d2b529e88..a8e4e71bf6 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -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++) {
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 78680441a8..81301edbfe 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -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;
     }
 }



More information about the ffmpeg-cvslog mailing list