Skip to content

Commit 4517c15

Browse files
committed
testcard patt=bars: annotate font sz in pt
multiples of base font bitmap font height is used
1 parent 71fb7e8 commit 4517c15

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/libavcodec/to_lavc_vid_conv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ static void r12l_to_gbrp16le(AVFrame * __restrict out_frame, const unsigned char
11141114
static void r12l_to_gbrp12le(AVFrame * __restrict out_frame, const unsigned char * __restrict in_data, int width, int height)
11151115
{
11161116
r12l_to_gbrpXXle(out_frame, in_data, width, height, 12U);
1117+
memset(out_frame->data[1], 255, 5000);
11171118
}
11181119

11191120
static void rg48_to_gbrp12le(AVFrame * __restrict out_frame, const unsigned char * __restrict in_data, int width, int height)

src/utils/video_pattern_generator.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "debug.h"
6565
#include "pixfmt_conv.h"
6666
#include "ug_runtime_error.hpp"
67+
#include "utils/bitmap_font.h" // for FONT_H
6768
#include "utils/color_out.h"
6869
#include "utils/macros.h"
6970
#include "utils/string_view_utils.hpp"
@@ -164,16 +165,20 @@ class image_pattern_bars : public image_pattern {
164165
if (init == "help"s) {
165166
col() << "Testcard bar usage:\n\t"
166167
<< SBOLD(SRED("-t testcard:pattern=bars")
167-
<< "[=<text>[,big]]")
168-
<< " - optionally annotate with text (+ big font)" << "\n";
168+
<< "[=<text>[,XYpt]]")
169+
<< " - optionally annotate with text (+ opt font size)" << "\n";
169170
throw 1;
170171
}
171172
annotate = init;
172173

173-
const std::string::size_type n = annotate.find(",big");
174-
if (n == annotate.size() - 4) {
175-
annotate.resize(n);
176-
big = true;
174+
const char *last_comma = strrchr(init.c_str(), ',');
175+
if (last_comma != nullptr) {
176+
char *endptr = nullptr;
177+
long val = strtol(last_comma + 1, &endptr, 10);
178+
if (strcmp(endptr, "pt") == 0) {
179+
annotate.resize(annotate.rfind(','));
180+
scale = (val + FONT_H - 1) / FONT_H;
181+
}
177182
}
178183
}
179184
private:
@@ -219,12 +224,12 @@ class image_pattern_bars : public image_pattern {
219224
if (!annotate.empty()) {
220225
draw_line_scaled((char *) data, width * 4,
221226
annotate.c_str(), 0xFFFFFFFF,
222-
0xFF000000, big ? 6 : 1);
227+
0xFF000000, scale);
223228
}
224229
return generator_depth::bits8;
225230
}
226231
string annotate;
227-
bool big = false;
232+
int scale = 6;
228233
};
229234

230235
/**
@@ -846,7 +851,7 @@ video_pattern_generator_create(const char *config, int width, int height, codec_
846851
col() << "Pattern to use, one of: \n";
847852
for (const auto *p :
848853
{
849-
"bars[=<text>[,big]]",
854+
"bars[=<text>[,XYpt]]",
850855
BLANK_USAGE,
851856
"diagonal*",
852857
"ebu_bars",

0 commit comments

Comments
 (0)