+static void iblend_vline(uint8_t *dst, int height, int linesize, float o1, float o2, int v, int step)
+{
+ int y;
+
+ for (y = 0; y < height; y += step) {
+ dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
+
+ dst += linesize * step;
+ }
+}
+
+static void iblend_vline16(uint8_t *ddst, int height, int linesize, float o1, float o2, int v, int step)
+{
+ uint16_t *dst = (uint16_t *)ddst;
+ int y;
+
+ for (y = 0; y < height; y += step) {
+ dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
+
+ dst += (linesize / 2) * step;
+ }
+}
+
+static void iblend_hline(uint8_t *dst, int width, int unused, float o1, float o2, int v, int step)
+{
+ int x;
+
+ for (x = 0; x < width; x += step) {
+ dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
+ }
+}
+
+static void iblend_hline16(uint8_t *ddst, int width, int unused, float o1, float o2, int v, int step)
+{
+ uint16_t *dst = (uint16_t *)ddst;
+ int x;
+
+ for (x = 0; x < width; x += step) {
+ dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
+ }
+}
+
+static void idraw_htext(AVFrame *out, int x, int y, int mult, float o1, float o2, const char *txt, const uint8_t color[4])
+{
+ const uint8_t *font;
+ int font_height;
+ int i, plane;
+
+ font = avpriv_cga_font, font_height = 8;
+
+ for (plane = 0; plane < 4 && out->data[plane]; plane++) {
+ for (i = 0; txt[i]; i++) {
+ int char_y, mask;
+ int v = color[plane];
+
+ uint8_t *p = out->data[plane] + y * out->linesize[plane] + (x + i * 8);
+ for (char_y = 0; char_y < font_height; char_y++) {
+ for (mask = 0x80; mask; mask >>= 1) {
+ if (font[txt[i] * font_height + char_y] & mask)
+ p[0] = p[0] * o2 + (v - p[0]) * o1;
+ p++;
+ }
+ p += out->linesize[plane] - 8;
+ }
+ }
+ }
+}
+
+static void idraw_htext16(AVFrame *out, int x, int y, int mult, float o1, float o2, const char *txt, const uint8_t color[4])
+{
+ const uint8_t *font;
+ int font_height;
+ int i, plane;
+
+ font = avpriv_cga_font, font_height = 8;
+
+ for (plane = 0; plane < 4 && out->data[plane]; plane++) {
+ for (i = 0; txt[i]; i++) {
+ int char_y, mask;
+ int v = color[plane] * mult;
+
+ uint16_t *p = (uint16_t *)(out->data[plane] + y * out->linesize[plane]) + (x + i * 8);
+ for (char_y = 0; char_y < font_height; char_y++) {
+ for (mask = 0x80; mask; mask >>= 1) {
+ if (font[txt[i] * font_height + char_y] & mask)
+ p[0] = p[0] * o2 + (v - p[0]) * o1;
+ p++;
+ }
+ p += out->linesize[plane] / 2 - 8;
+ }
+ }
+ }
+}
+
+static void idraw_vtext(AVFrame *out, int x, int y, int mult, float o1, float o2, const char *txt, const uint8_t color[4])
+{
+ const uint8_t *font;
+ int font_height;
+ int i, plane;
+
+ font = avpriv_cga_font, font_height = 8;
+
+ for (plane = 0; plane < 4 && out->data[plane]; plane++) {
+ for (i = 0; txt[i]; i++) {
+ int char_y, mask;
+ int v = color[plane];
+
+ for (char_y = font_height - 1; char_y >= 0; char_y--) {
+ uint8_t *p = out->data[plane] + (y + i * 10) * out->linesize[plane] + x;
+ for (mask = 0x80; mask; mask >>= 1) {
+ if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
+ p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
+ p += out->linesize[plane];
+ }
+ }
+ }
+ }
+}
+
+static void idraw_vtext16(AVFrame *out, int x, int y, int mult, float o1, float o2, const char *txt, const uint8_t color[4])
+{
+ const uint8_t *font;
+ int font_height;
+ int i, plane;
+
+ font = avpriv_cga_font, font_height = 8;
+
+ for (plane = 0; plane < 4 && out->data[plane]; plane++) {
+ for (i = 0; txt[i]; i++) {
+ int char_y, mask;
+ int v = color[plane] * mult;
+
+ for (char_y = 0; char_y < font_height; char_y++) {
+ uint16_t *p = (uint16_t *)(out->data[plane] + (y + i * 10) * out->linesize[plane]) + x;
+ for (mask = 0x80; mask; mask >>= 1) {
+ if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
+ p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
+ p += out->linesize[plane] / 2;
+ }
+ }
+ }
+ }
+}
+