• [c+ai] one night with image codec

    From fir@profesor.fir@gmail.com to comp.lang.c on Thu Sep 24 15:36:39 2026
    From Newsgroup: comp.lang.c

    i once was writing on this -
    the idea is take bitmap (like 960x540) take some pixels of it
    (in practice i take liek 2% maybe 5% random pixels store it as a file
    (new image codec) and interpolate it to recreate the image

    i just wonder how it would work..
    it was a bit to tedious to write it alone but in present times you just
    say it to chat gpt and it practically write it to yourself

    the technical quest is here mainly

    1) what interpolation function tu use (ai write me some im not sure how
    good it is)

    2) optimiser function - it just generates various pixels interpolate and compare it to oryginal bitmap searching for least error among
    interpolated and oryginal

    3) additionally if i store this 2% pixels in disk file there is
    also option to store it in most 'packed' way..right now i just
    used 3 butes for storing xy of pixels (12 bits for x and 12 bits y)
    and 3 bytes for rgb color - so on pixel its 6 bytes

    generally t showed to work like i take about 2 MB source bitmap
    and result is about 180kb -250kb result that in fact is not such bad
    (i could post pices of images how it work but later)

    its notably worse than jpg of its size but still its quite ok


    almost whole code here was simply generated by ai..and i post it below

    it is in some kind interesting topic...so if someone want to comment on
    that may commnet on tah if no may just ignore (the group has not so
    many topics to comment so i dont hink is harm such post on this)



    (note i compile in c++ mode as i dont ike use #defines i prefer use
    const int from c++, also i use my own green fire library to setup
    windowm with frame bitmap i cant set pixels to it and draw things on
    client area of window)



    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"



    const int GRID_SIZE = 5;
    const int INTERP_K = 3;

    const int MIN_POINTS_PER_GRID = 1;
    const int MAX_POINTS_PER_GRID = 10;

    const int TRIALS = 100; //50
    const int OPT_PASSES = 5; //10


    typedef struct {
    short x, y;
    unsigned color;
    } PointColor;


    typedef struct {
    unsigned *pixels;
    int w, h, stride;
    } Bitmap;


    typedef struct {
    int *p;
    int n;
    } GridCell;


    static GridCell *grid;
    static int grid_w, grid_h;



    int LoadBitmap(const char *filename, Bitmap *b)
    {
    HBITMAP bmp = (HBITMAP)LoadImageA(
    0, filename, IMAGE_BITMAP, 0, 0,
    LR_LOADFROMFILE | LR_CREATEDIBSECTION);

    if (!bmp)
    {
    ERROR_("LoadImageA failed");
    return 0;
    }

    DIBSECTION ds;

    if (!GetObject(bmp, sizeof(ds), &ds))
    {
    ERROR_("GetObject failed");
    DeleteObject(bmp);
    return 0;
    }

    int bpp = ds.dsBm.bmBitsPixel;

    if (bpp != 24 && bpp != 32)
    {
    ERROR_("bitmap must be 24 or 32 bit");
    DeleteObject(bmp);
    return 0;
    }

    b->w = ds.dsBm.bmWidth;
    b->h = ds.dsBm.bmHeight;
    b->stride = b->w;

    b->pixels = (unsigned*)malloc(
    b->w * b->h * sizeof(unsigned));

    if (!b->pixels)
    {
    DeleteObject(bmp);
    return 0;
    }

    unsigned char *src =
    (unsigned char*)ds.dsBm.bmBits;

    int src_stride = ds.dsBm.bmWidthBytes;
    int top_down = ds.dsBmih.biHeight < 0;

    for (int y = 0; y < b->h; y++)
    {
    int sy = top_down ? y : b->h - 1 - y;

    unsigned char *row =
    src + sy * src_stride;

    for (int x = 0; x < b->w; x++)
    {
    unsigned char *p =
    row + x * (bpp / 8);

    // BMP stores B,G,R,(A)
    b->pixels[y * b->w + x] =
    p[0] | (p[1] << 8) | (p[2] << 16);
    }
    }

    DeleteObject(bmp);
    return 1;
    }

    static int ColorError(unsigned a, unsigned b)
    {
    Color ca, cb;

    ca.u = a;
    cb.u = b;

    int dr = ca.r - cb.r;
    int dg = ca.g - cb.g;
    int db = ca.b - cb.b;

    return dr * dr +
    dg * dg +
    db * db;
    }


    /*
    * Lokalna "z+eo++ono+c-c" grida.
    *
    * Liczymy r||++nice pomi-Odzy s-asiednimi
    * pikselami. Jednolity obszar daje ma+ey
    * wynik, kraw-Odzie i tekst du++y.
    */
    static long long GridComplexity(
    unsigned *src,
    int stride,
    int gx,
    int gy)
    {
    const int x0 = gx * GRID_SIZE;
    const int y0 = gy * GRID_SIZE;

    int x1 = x0 + GRID_SIZE;
    int y1 = y0 + GRID_SIZE;

    if (x1 > frame_size_x)
    x1 = frame_size_x;

    if (y1 > frame_size_y)
    y1 = frame_size_y;

    long long e = 0;

    for (int y = y0; y < y1; y++) {

    for (int x = x0; x < x1; x++) {

    if (x + 1 < x1)
    e += ColorError(
    src[y * stride + x],
    src[y * stride + x + 1]);

    if (y + 1 < y1)
    e += ColorError(
    src[y * stride + x],
    src[(y + 1) * stride + x]);
    }
    }

    return e;
    }


    /*
    * Na podstawie ca+eego obrazu ustalamy
    * progi dla 1..MAX_POINTS_PER_GRID punkt||w.
    *
    * U++ywamy min/max z+eo++ono+cci grid||w.
    */
    static int *BuildPointCounts(
    unsigned *src,
    int stride)
    {
    const int grid_n =
    grid_w * grid_h;

    long long *complexity =
    (long long*)malloc(
    grid_n * sizeof(long long));

    long long min_c = 0;
    long long max_c = 0;

    for (int gy = 0; gy < grid_h; gy++)
    for (int gx = 0; gx < grid_w; gx++) {

    const int i =
    gy * grid_w + gx;

    complexity[i] =
    GridComplexity(
    src,
    stride,
    gx,
    gy);

    if (!i ||
    complexity[i] < min_c)
    min_c = complexity[i];

    if (!i ||
    complexity[i] > max_c)
    max_c = complexity[i];
    }


    int *counts =
    (int*)malloc(
    grid_n * sizeof(int));


    /*
    * Je++eli ca+ey obraz jest prawie jednolity,
    * nie ma sensu robi-c wielu punkt||w.
    */
    if (max_c == min_c) {

    for (int i = 0; i < grid_n; i++)
    counts[i] =
    MIN_POINTS_PER_GRID;

    free(complexity);
    return counts;
    }


    /*
    * Logarytmiczna skala daje wi-Ocej punkt||w
    * obszarom z naprawd-O du++-a zmienno+cci-a,
    * zamiast rozdziela-c punkty liniowo.
    *
    * Tu u++ywamy prostego przybli++enia:
    *
    * normalized = (c-min)/(max-min)
    *
    * a potem pot-Ogowanie przez 0.5,
    * czyli sqrt(normalized).
    */
    const double range =
    (double)(max_c - min_c);

    for (int i = 0; i < grid_n; i++) {

    double t =
    (complexity[i] - min_c) /
    range;

    t = sqrt(t);

    int n =
    MIN_POINTS_PER_GRID +
    (int)(
    t *
    (MAX_POINTS_PER_GRID -
    MIN_POINTS_PER_GRID));

    if (n < MIN_POINTS_PER_GRID)
    n = MIN_POINTS_PER_GRID;

    if (n > MAX_POINTS_PER_GRID)
    n = MAX_POINTS_PER_GRID;

    counts[i] = n;
    }

    free(complexity);

    return counts;
    }


    /*
    * Losujemy pocz-atkowe punkty,
    * ale liczba punkt||w jest adaptacyjna.
    *
    * points_count[i] m||wi ile punkt||w
    * ma grid i.
    */
    static int RandomSamplesAdaptive(
    PointColor *p,
    int *points_count,
    Bitmap *b)
    {
    grid_w =
    (b->w + GRID_SIZE - 1) /
    GRID_SIZE;

    grid_h =
    (b->h + GRID_SIZE - 1) /
    GRID_SIZE;

    int k = 0;

    for (int gy = 0; gy < grid_h; gy++)
    for (int gx = 0; gx < grid_w; gx++) {

    const int gi =
    gy * grid_w + gx;

    const int x0 =
    gx * GRID_SIZE;

    const int y0 =
    gy * GRID_SIZE;

    int x1 =
    x0 + GRID_SIZE;

    int y1 =
    y0 + GRID_SIZE;

    if (x1 > b->w)
    x1 = b->w;

    if (y1 > b->h)
    y1 = b->h;

    for (int j = 0;
    j < points_count[gi];
    j++) {

    int x =
    x0 + rand() % (x1 - x0);

    int y =
    y0 + rand() % (y1 - y0);

    p[k].x = (short)x;
    p[k].y = (short)y;

    p[k].color =
    b->pixels[
    y * b->stride + x];

    k++;
    }
    }

    return k;
    }



    static unsigned InterpolatePixel(PointColor *points, int x, int y)
    {
    const int gx = x / GRID_SIZE;
    const int gy = y / GRID_SIZE;

    int kd[INTERP_K];
    int kdist[INTERP_K];
    int kn = 0;

    for (int cy = gy - 1; cy <= gy + 1; cy++) {
    if (cy < 0 || cy >= grid_h) continue;

    for (int cx = gx - 1; cx <= gx + 1; cx++) {
    if (cx < 0 || cx >= grid_w) continue;

    GridCell *c = &grid[cy * grid_w + cx];

    for (int j = 0; j < c->n; j++) {
    const int pi = c->p[j];
    const int dx = points[pi].x - x;
    const int dy = points[pi].y - y;
    const int d2 = dx * dx + dy * dy;

    if (!d2) return points[pi].color;

    if (kn < INTERP_K) {
    int k = kn++;

    while (k && d2 < kdist[k - 1]) {
    kdist[k] = kdist[k - 1];
    kd[k] = kd[k - 1];
    k--;
    }

    kdist[k] = d2;
    kd[k] = pi;
    }
    else if (d2 < kdist[INTERP_K - 1]) {
    int k = INTERP_K - 1;

    while (k && d2 < kdist[k - 1]) {
    kdist[k] = kdist[k - 1];
    kd[k] = kd[k - 1];
    k--;
    }

    kdist[k] = d2;
    kd[k] = pi;
    }
    }
    }
    }

    if (!kn) return 0;

    double sr = 0, sg = 0, sb = 0, sw = 0;

    for (int i = 0; i < kn; i++) {
    Color c;
    c.u = points[kd[i]].color;

    // const double w = 1.0 / kdist[i];
    const double w = 1.0 / (double)(kdist[i] * kdist[i]);
    // const double w = exp(-kdist[i] / 50.0);

    sr += c.r * w;
    sg += c.g * w;
    sb += c.b * w;
    sw += w;
    }

    Color c;
    c.r = (unsigned char)(sr / sw + 0.5);
    c.g = (unsigned char)(sg / sw + 0.5);
    c.b = (unsigned char)(sb / sw + 0.5);
    c.a = 0;

    return c.u;
    }


    static long long GridError(
    PointColor *points,
    unsigned *src,
    int src_stride,
    int gx,
    int gy)
    {
    const int x0 =
    gx * GRID_SIZE;

    const int y0 =
    gy * GRID_SIZE;

    int x1 =
    x0 + GRID_SIZE;

    int y1 =
    y0 + GRID_SIZE;

    if (x1 > frame_size_x)
    x1 = frame_size_x;

    if (y1 > frame_size_y)
    y1 = frame_size_y;

    long long error = 0;

    for (int y = y0; y < y1; y++)
    for (int x = x0; x < x1; x++)
    error += ColorError(
    InterpolatePixel(
    points,
    x,
    y),
    src[y * src_stride + x]);

    return error;
    }


    void OptimizeGridSamples(
    PointColor *points,
    int n,
    int *points_count,
    unsigned *src,
    int src_stride)
    {
    grid_w =
    (frame_size_x + GRID_SIZE - 1) /
    GRID_SIZE;

    grid_h =
    (frame_size_y + GRID_SIZE - 1) /
    GRID_SIZE;

    const int grid_n =
    grid_w * grid_h;

    grid =
    (GridCell*)calloc(
    grid_n,
    sizeof(GridCell));


    /*
    * Poniewa++ liczba punkt||w w gridzie
    * jest ju++ ustalona, mo++emy od razu
    * zaalokowa-c dok+eadne tablice.
    */
    int k = 0;

    for (int i = 0; i < grid_n; i++) {

    const int count =
    points_count[i];

    grid[i].n = count;

    grid[i].p =
    (int*)malloc(
    count * sizeof(int));

    for (int j = 0; j < count; j++)
    grid[i].p[j] = k++;
    }


    for (int pass = 0;
    pass < OPT_PASSES;
    pass++) {

    for (int gy = 0;
    gy < grid_h;
    gy++) {

    for (int gx = 0;
    gx < grid_w;
    gx++) {

    GridCell *cell =
    &grid[
    gy * grid_w + gx];

    const int count =
    cell->n;

    PointColor *best =
    (PointColor*)malloc(
    count *
    sizeof(PointColor));

    for (int i = 0;
    i < count;
    i++)
    best[i] =
    points[cell->p[i]];


    long long best_error =
    GridError(
    points,
    src,
    src_stride,
    gx,
    gy);


    const int x0 =
    gx * GRID_SIZE;

    const int y0 =
    gy * GRID_SIZE;

    int x1 =
    x0 + GRID_SIZE;

    int y1 =
    y0 + GRID_SIZE;

    if (x1 > frame_size_x)
    x1 = frame_size_x;

    if (y1 > frame_size_y)
    y1 = frame_size_y;


    for (int trial = 0;
    trial < TRIALS;
    trial++) {

    for (int i = 0;
    i < count;
    i++) {

    const int x =
    x0 +
    rand() %
    (x1 - x0);

    const int y =
    y0 +
    rand() %
    (y1 - y0);

    PointColor *p =
    &points[cell->p[i]];

    p->x = (short)x;
    p->y = (short)y;

    p->color =
    src[
    y * src_stride +
    x];
    }


    const long long error =
    GridError(
    points,
    src,
    src_stride,
    gx,
    gy);


    if (error < best_error) {

    best_error = error;

    for (int i = 0;
    i < count;
    i++)
    best[i] =
    points[cell->p[i]];
    }
    }


    for (int i = 0;
    i < count;
    i++)
    points[cell->p[i]] =
    best[i];

    free(best);
    }
    }
    }


    for (int i = 0;
    i < grid_n;
    i++)
    free(grid[i].p);

    free(grid);
    grid = 0;
    }



    static int DumpSamples(
    const char *filename,
    PointColor *points,
    int n)
    {
    FILE *f = fopen(filename, "wb");

    if (!f)
    return 0;

    /* magic */
    const unsigned char magic[4] = {'F', 'I', 'M', 'A'};

    if (fwrite(magic, 1, 4, f) != 4) {
    fclose(f);
    return 0;
    }

    /* image dimensions */
    uint16_t w = (uint16_t)frame_size_x;
    uint16_t h = (uint16_t)frame_size_y;

    if (fwrite(&w, 2, 1, f) != 1 ||
    fwrite(&h, 2, 1, f) != 1) {
    fclose(f);
    return 0;
    }

    /*
    * x and y are both <= 10 bits for 960x540.
    * Pack them into 20 bits:
    *
    * bits 0.. 9 = x
    * bits 10..19 = y
    */
    for (int i = 0; i < n; i++) {
    const unsigned x = (unsigned)points[i].x;
    const unsigned y = (unsigned)points[i].y;

    const unsigned xy = x | (y << 10);

    unsigned char p[6];

    p[0] = (unsigned char)(xy);
    p[1] = (unsigned char)(xy >> 8);
    p[2] = (unsigned char)(xy >> 16);

    Color c;
    c.u = points[i].color;

    p[3] = c.r;
    p[4] = c.g;
    p[5] = c.b;

    if (fwrite(p, 1, 6, f) != 6) {
    fclose(f);
    return 0;
    }
    }

    fclose(f);
    return 1;
    }


    static PointColor *LoadSamples(
    const char *filename,
    int *w,
    int *h,
    int *n)
    {
    FILE *f = fopen(filename, "rb");

    if (!f)
    return 0;

    unsigned char magic[4];

    if (fread(magic, 1, 4, f) != 4 ||
    magic[0] != 'F' ||
    magic[1] != 'I' ||
    magic[2] != 'M' ||
    magic[3] != 'A') {
    fclose(f);
    return 0;
    }

    uint16_t uw, uh;

    if (fread(&uw, 2, 1, f) != 1 ||
    fread(&uh, 2, 1, f) != 1) {
    fclose(f);
    return 0;
    }

    *w = uw;
    *h = uh;

    fseek(f, 0, SEEK_END);
    const long file_size = ftell(f);
    fseek(f, 8, SEEK_SET);

    if (file_size < 8 || (file_size - 8) % 6 != 0) {
    fclose(f);
    return 0;
    }

    *n = (int)((file_size - 8) / 6);

    PointColor *points =
    (PointColor*)malloc(*n * sizeof(PointColor));

    if (!points) {
    fclose(f);
    return 0;
    }

    for (int i = 0; i < *n; i++) {
    unsigned char p[6];

    if (fread(p, 1, 6, f) != 6) {
    free(points);
    fclose(f);
    return 0;
    }

    const unsigned xy =
    (unsigned)p[0] |
    ((unsigned)p[1] << 8) |
    ((unsigned)p[2] << 16);

    points[i].x = (short)(xy & 1023);
    points[i].y = (short)((xy >> 10) & 1023);

    Color c;
    c.r = p[3];
    c.g = p[4];
    c.b = p[5];
    c.a = 0;

    points[i].color = c.u;
    }

    fclose(f);
    return points;
    }


    static void BuildGrid(
    PointColor *points,
    int n)
    {
    grid_w =
    (frame_size_x + GRID_SIZE - 1) /
    GRID_SIZE;

    grid_h =
    (frame_size_y + GRID_SIZE - 1) /
    GRID_SIZE;

    grid =
    (GridCell*)calloc(
    grid_w * grid_h,
    sizeof(GridCell));


    for (int i = 0; i < n; i++) {

    int gx =
    points[i].x /
    GRID_SIZE;

    int gy =
    points[i].y /
    GRID_SIZE;

    if (gx < 0 ||
    gx >= grid_w ||
    gy < 0 ||
    gy >= grid_h)
    continue;

    grid[
    gy * grid_w + gx
    ].n++;
    }


    for (int i = 0;
    i < grid_w * grid_h;
    i++) {

    if (grid[i].n) {

    int n =
    grid[i].n;

    grid[i].p =
    (int*)malloc(
    n * sizeof(int));

    grid[i].n = 0;
    }
    }


    for (int i = 0; i < n; i++) {

    int gx =
    points[i].x /
    GRID_SIZE;

    int gy =
    points[i].y /
    GRID_SIZE;

    if (gx < 0 ||
    gx >= grid_w ||
    gy < 0 ||
    gy >= grid_h)
    continue;

    GridCell *c =
    &grid[
    gy * grid_w + gx];

    c->p[c->n++] = i;
    }
    }


    void InterpolateBitmap(
    PointColor *points,
    int n)
    {
    BuildGrid(points, n);

    for (int y = 0;
    y < frame_size_y;
    y++)
    for (int x = 0;
    x < frame_size_x;
    x++)
    SetPixelUnsafe(
    x,
    y,
    InterpolatePixel(
    points,
    x,
    y));

    for (int i = 0;
    i < grid_w * grid_h;
    i++)
    free(grid[i].p);

    free(grid);
    grid = 0;
    }


    DrawKeyPoints(PointColor *points, int n)
    {
    for(int i=0;i<n; i++)
    SetPixelUnsafe(points[i].x, points[i].y, 0x0000);
    }


    char* args_filename = NULL;

    static int LoadSamplesAndDisplay(const char *filename)
    {
    int w, h, n;

    PointColor *points =
    LoadSamples(filename, &w, &h, &n);

    if (!points)
    return 0;

    frame_size_x = w;
    frame_size_y = h;

    /*
    * Standard reconstruction.
    * InterpolateBitmap() eventually uses SetPixelUnsafe()
    * for every output pixel.
    */
    InterpolateBitmap(points, n);

    free(points);

    return 1;
    }



    char* input = "photo1.bmp";

    test_opt()
    {
    Bitmap bitmap;

    if (!LoadBitmap(
    input,
    &bitmap))
    ERROR_("cant load bitmap");


    grid_w =
    (bitmap.w + GRID_SIZE - 1) /
    GRID_SIZE;

    grid_h =
    (bitmap.h + GRID_SIZE - 1) /
    GRID_SIZE;


    const int grid_n =
    grid_w * grid_h;


    /*
    * Najpierw okre+cl, ile punkt||w
    * dostaje ka++dy grid.
    */
    int *points_count =
    BuildPointCounts(
    bitmap.pixels,
    bitmap.stride);


    /*
    * Zsumuj liczb-O punkt||w.
    */
    int N = 0;

    for (int i = 0;
    i < grid_n;
    i++)
    N += points_count[i];


    PointColor *points =
    (PointColor*)malloc(
    N * sizeof(PointColor));


    /*
    * Adaptacyjne rozmieszczenie
    * pocz-atkowych pr||bek.
    */
    RandomSamplesAdaptive(
    points,
    points_count,
    &bitmap);


    OptimizeGridSamples(
    points,
    N,
    points_count,
    bitmap.pixels,
    bitmap.stride);


    DumpSamples(
    "sample.fima",
    points,
    N);


    InterpolateBitmap(
    points,
    N);


    if(i_toggler) DrawKeyPoints(points, N);


    free(points_count);
    }


    test()
    {
    Bitmap bitmap;

    if (!LoadBitmap(
    input,
    &bitmap))
    ERROR_("cant load bitmap");


    grid_w =
    (bitmap.w + GRID_SIZE - 1) /
    GRID_SIZE;

    grid_h =
    (bitmap.h + GRID_SIZE - 1) /
    GRID_SIZE;


    const int grid_n =
    grid_w * grid_h;


    int *points_count =
    BuildPointCounts(
    bitmap.pixels,
    bitmap.stride);


    int N = 0;

    for (int i = 0;
    i < grid_n;
    i++)
    N += points_count[i];


    PointColor *points =
    (PointColor*)malloc(
    N * sizeof(PointColor));


    RandomSamplesAdaptive(
    points,
    points_count,
    &bitmap);


    /*
    * OptimizeGridSamples(
    * points,
    * N,
    * points_count,
    * bitmap.pixels,
    * bitmap.stride);
    */


    InterpolateBitmap(
    points,
    N);


    if(i_toggler) DrawKeyPoints(points, N);

    free(points_count);
    }





















    void ProcessMouseMove(int x_, int y_){}


    void ProcessKeyDown(int key)
    {

    if(key==VK_SPACE)
    {
    test_opt();
    }

    if(key=='A')
    test();




    }
    void OnResize(){}

    void OnRMBDown(int x, int y)
    {

    }

    void OnLMBDown(int x, int y)
    {

    }

    void DrawFrame()
    {

    }


    void RunFrame(int advance)
    {

    static int initialised = 0;
    if(!initialised)
    {
    initialised =1;

    if(args_filename)
    {
    if (!LoadSamplesAndDisplay(args_filename))
    {
    ERROR_("Failed to load FIMA file: %s\n", args_filename);

    }
    return;

    }


    test();

    }


    }




    int main(int argc, char **argv)
    {
    if (argc == 2)
    {
    args_filename= argv[1];
    }


    RegisterMouseMove( ProcessMouseMove );
    RegisterKeyDown( ProcessKeyDown );
    RegisterOnResize( OnResize );
    RegisterRunFrame( RunFrame );
    SetSleepValue(10);
    SetScaleOnResize(1);
    RegisterLeftMouseButtonDown( OnLMBDown );
    RegisterRightMouseButtonDown(OnRMBDown );

    float screen_size_y = GetSystemMetrics(SM_CYSCREEN);

    SetupWindow4(" FIR'S INTERPOLATED IMAGE CODECK ", 10, 10, .9,
    .9, 600 );

    return 0;
    }


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Sep 24 16:06:00 2026
    From Newsgroup: comp.lang.c

    here are the results (if i not mistaken the links as after upload my
    names vanished)

    this is this codec with interpolation randomly chosen points (240 kb)

    https://relavo.net/v/SZDWh8l

    this is the codec after tuning this optimising routine and carefully
    chosen points (same interpolation) (240 kb)

    https://relavo.net/v/DGANW4e

    this is oryginal bitmap 2.07 MB

    https://relavo.net/v/G563DYM

    this is jotpeg 113 kb (if im not wrong with files , not carefully
    checked yet... it should be difference compered to oryginal bitmap i guess)

    https://relavo.net/v/HotiojQ

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Sep 24 16:17:22 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    here are the results (if i not mistaken the links as after upload my
    names vanished)

    this is this codec with interpolation randomly chosen points (240 kb)

    https://relavo.net/v/SZDWh8l

    this is the codec after tuning this optimising routine and carefully
    chosen points (same interpolation) (240 kb)

    https://relavo.net/v/DGANW4e

    this is oryginal bitmap 2.07 MB

    https://relavo.net/v/G563DYM

    this is jotpeg 113 kb (if im not wrong with files , not carefully
    checked yet... it should be difference compered to oryginal bitmap i guess)

    https://relavo.net/v/HotiojQ


    the quetion is ofc how to upgrade this (thou as i coded it in night i
    not feel a much urge to improve it but i find its interesting)

    note this 240 kb may be simply reduced as i use 6 bytes for
    typedef struct { short x, y; unsigned color;} PointColor;

    where i probably should not store x,y but deltas among pixels in image
    (i mean as p = x +width*y and thise linear deltas probably mostly fit in
    one byte or maybe 9 bits so short x,y (whis i packed to 3 bytes , 12
    bits for each) may be packed in one byte thus leading to 33% size reduction...maybe also some approcha to color pallete can also reduce
    rgba values



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Thu Sep 24 15:30:50 2026
    From Newsgroup: comp.lang.c

    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers and
    any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs this
    big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Sep 24 16:45:33 2026
    From Newsgroup: comp.lang.c

    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers and
    any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in green-fire.h that makes it possible?


    i dont know its ai generated and just work (its not in green fore - in
    green fire i got a code that setups winapi window, generates frame
    bitmap of point, has some raster based drawing routines, code for
    generating raster fonts from ttf fonts that i can then use to write on
    screen in pixel based scenario, things like that)


    BTW as to this code above which AI generated how it work


    const int GRID_SIZE = 5;
    const int INTERP_K = 3;

    const int MIN_POINTS_PER_GRID = 1;
    const int MAX_POINTS_PER_GRID = 10;

    const int TRIALS = 100; //50
    const int OPT_PASSES = 5; //10


    it generates a grids of some size GRID_SIZE (5 seem work ok)
    and then generates the points for evary grid cell
    (here form 1 to 10) ...though interpolation as far as
    it seems only uses INTERP_K closest points to interpolate given pixel
    color (i experimented and it seem not very much difference with
    higher values so here is only 3)

    then it makes number of TRIALS passes to set pioints in grid in random
    and trying to search whith base of it fits best (less error compared to oryginal image) then it yet ises OPT_PASSES becouse this optimisation
    works inside one grid but the result depend also on 9 near grids so
    it is in passesto find for each grid/sells than if those near cells
    changed search again

    it is all suggested mostly by ai and i thing possibbly there could be
    found something that works much better eventually but no got clear idea
    at the moment

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Sep 24 18:27:15 2026
    From Newsgroup: comp.lang.c

    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers and
    any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in green-fire.h that makes it possible?


    i checked if the makero LoadBitmap is defined it seems so,LoadBitmap
    from winapi is

    also visible (coz if i comented definitions and only left calls it
    showed error that arguments non compatible

    so i dont know..i dont kare for such things as i not use macros in my
    life..it compiles seamlessly

    but note i compile is c++ mode (onlu usung it for "const int tab_max")

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c on Thu Sep 24 16:31:44 2026
    From Newsgroup: comp.lang.c

    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for
    LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Fri Sep 25 02:05:35 2026
    From Newsgroup: comp.lang.c

    Chris M. Thomasson pisze:
    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for
    LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    i asked ai for answer:

    PUKE!
    What a magnificent contribution to the discussion.
    I can see you're a man of deep technical insight rCo AI bad, therefore puke.
    Do try to contain yourself, old chap. The machines are coming anyway.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.c on Fri Sep 25 10:38:10 2026
    From Newsgroup: comp.lang.c

    On 24/09/2026 18:27, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for
    LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i checked if the makero LoadBitmap-a is defined it seems so,LoadBitmap
    from winapi is

    also visible (coz if i comented definitions and only left calls it
    showed error that arguments non compatible

    so i dont know..i dont kare for such things as i not use macros in my life..it compiles seamlessly


    Don't be silly. C macros are part of C programming, whether you like
    them or not - the first line of your posted code is a macro definition!
    And Bart was talking about a macro defined in <windows.h>, not your code.

    but note i compile is c++ mode (onlu usung it for "const int tab_max")


    If you are compiling as C++, then you will have C++ linkage and C++
    mangled names (unless you have an extern "C" in effect). C++ supports function overloading - there is no problem having two functions with the
    same name but different parameters. If you don't understand this and
    don't know how it works, and randomly mix C code with C++ (or C compiled
    as C++), you will cause yourself confusion. Use C, or use C++ - and if
    you want to mix some C and some C++ files, do so in an informed and intentional manner.

    If all you want here is to be able to write something like :

    const int tab_max = 10;
    int table[tab_max];

    then in C you can simply use :

    enum { tab_max = 10 };
    int table[tab_max];

    or in C23 :

    constexpr int tab_max = 10;
    int table[tab_max];




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.c on Fri Sep 25 10:49:04 2026
    From Newsgroup: comp.lang.c

    On 24/09/2026 16:30, bart wrote:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers and
    any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in green- fire.h that makes it possible?



    What do you mean by "alias" here ? Do you mean a macro? A small static inline function? An identifier defined with an "alias" attribute
    (that's a gcc attribute, but I have no idea if it works on Windows
    targets) ? A C++ constexpr function alias?

    How this will work or not depends on what you mean.

    And of course it depends on which <windows.h> is used - it is not a
    remotely standardised header, and details vary enormously with different toolchains, libraries, versions, etc.

    Obviously Fir needs to answer much of this.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Fri Sep 25 10:57:55 2026
    From Newsgroup: comp.lang.c

    David Brown pisze:
    On 24/09/2026 18:27, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for
    LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i checked if the makero LoadBitmap-a is defined it seems so,LoadBitmap
    from winapi is

    also visible (coz if i comented definitions and only left calls it
    showed error that arguments non compatible

    so i dont know..i dont kare for such things as i not use macros in my
    life..it compiles seamlessly


    Don't be silly.-a C macros are part of C programming, whether you like
    them or not - the first line of your posted code is a macro definition!
    And Bart was talking about a macro defined in <windows.h>, not your code.

    but note i compile is c++ mode (onlu usung it for "const int tab_max")


    If you are compiling as C++, then you will have C++ linkage and C++
    mangled names (unless you have an extern "C" in effect).-a C++ supports function overloading - there is no problem having two functions with the same name but different parameters.-a If you don't understand this and
    don't know how it works, and randomly mix C code with C++ (or C compiled
    as C++), you will cause yourself confusion.-a Use C, or use C++ - and if
    you want to mix some C and some C++ files, do so in an informed and intentional manner.

    If all you want here is to be able to write something like :

    -a-a-a-aconst int tab_max = 10;
    -a-a-a-aint table[tab_max];

    then in C you can simply use :

    -a-a-a-aenum { tab_max = 10 };
    -a-a-a-aint table[tab_max];

    or in C23 :

    -a-a-a-aconstexpr int tab_max = 10;
    -a-a-a-aint table[tab_max];


    i dont care too much ..honesty i cant take a clear decision if to
    compile in c or c++ mode - i would eventually take one mode if it will
    prove soeme clear advantages (like compiling faster , makin less blot in
    exe or making faster executables - things like that)

    stylistycally i would slightly more compile in c++ mode becouse of those consts, also i dont like writying typedef struct and even i consider
    using references whose c++ has (though i not using it yet.. i avoid
    using pointers at all but for me a->b syntax is not to stand..but
    wide using of references is maybe a bit to big step out of clasic c)

    those enums i eventually could use and eventualli i could write
    this typedefs so yet i dont know, macros i will not use for sure

    this decision is overally not so much big deal as im rather able to
    change sources to migrate from this c++ mode into c or otherwise..
    seems not so much big deal to me

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Fri Sep 25 10:49:36 2026
    From Newsgroup: comp.lang.c

    On 25/09/2026 09:49, David Brown wrote:
    On 24/09/2026 16:30, bart wrote:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for
    LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green- fire.h that makes it possible?



    What do you mean by "alias" here ?-a Do you mean a macro?-a A small static inline function?-a An identifier defined with an "alias" attribute
    (that's a gcc attribute, but I have no idea if it works on Windows
    targets) ?-a A C++ constexpr function alias?

    It will usually be this:

    #ifdef UNICODE
    ...
    #define LoadBitmap LoadBitmapW
    ...
    #else
    ...
    #define LoadBitmap LoadBitmapA
    ...

    'UNICODE' is nearly always undefined. These aliases exist for pretty
    much every function takes or returns strings. The MS docs say this:

    "The winuser.h header defines LoadBitmap as an alias that automatically selects the ANSI or Unicode version of this function based on the
    definition of the UNICODE preprocessor constant."

    winuser.h will be part of the headers invoked by windows.h. But some C compilers use a monolithic windows.h and it will be in there.

    Ones like gcc will use a collection 90 headers, and MSVC some 160
    headers (or vice versa, as observed in 2017).


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Jim Jackson@jj@franjam.org.uk to comp.lang.c on Fri Sep 25 12:01:02 2026
    From Newsgroup: comp.lang.c


    Obviously Fir needs to answer much of this.

    even if he does, what are the chances that it makes sense? Save your energy. --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sat Sep 26 02:51:57 2026
    From Newsgroup: comp.lang.c

    Jim Jackson pisze:

    Obviously Fir needs to answer much of this.

    even if he does, what are the chances that it makes sense? Save your energy.


    there is some mental death in such kind of sentences.. you should avoid
    it for sure ( some here may be not so resistant to such mental death rays)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c on Sun Sep 27 15:05:07 2026
    From Newsgroup: comp.lang.c

    On 9/24/2026 5:05 PM, fir wrote:
    Chris M. Thomasson pisze:
    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers
    and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs
    this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias
    for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    i asked ai for answer:

    PUKE!
    What a magnificent contribution to the discussion.
    I can see you're a man of deep technical insight rCo AI bad, therefore puke. Do try to contain yourself, old chap. The machines are coming anyway.

    How long have you been on this group rambling about C?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bart@bc@freeuk.com to comp.lang.c on Mon Sep 28 00:44:38 2026
    From Newsgroup: comp.lang.c

    On 27/09/2026 23:05, Chris M. Thomasson wrote:
    On 9/24/2026 5:05 PM, fir wrote:
    Chris M. Thomasson pisze:
    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers >>>>> and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs >>>>> this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias
    for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in
    green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    i asked ai for answer:

    PUKE!
    What a magnificent contribution to the discussion.
    I can see you're a man of deep technical insight rCo AI bad, therefore
    puke.
    Do try to contain yourself, old chap. The machines are coming anyway.

    How long have you been on this group rambling about C?

    Yeah, maybe he should be having more dialogues with AI than here, as it
    (she?) seems to have all the answers.

    Maybe it can reply in a sexy voice too? (I've never used it so don't
    know if it can talk.)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Mon Sep 28 04:22:46 2026
    From Newsgroup: comp.lang.c

    bart pisze:
    On 27/09/2026 23:05, Chris M. Thomasson wrote:
    On 9/24/2026 5:05 PM, fir wrote:
    Chris M. Thomasson pisze:
    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the
    headers and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for
    programs this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias >>>>>> for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in >>>>>> green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    i asked ai for answer:

    PUKE!
    What a magnificent contribution to the discussion.
    I can see you're a man of deep technical insight rCo AI bad, therefore
    puke.
    Do try to contain yourself, old chap. The machines are coming anyway.

    How long have you been on this group rambling about C?

    Yeah, maybe he should be having more dialogues with AI than here, as it (she?) seems to have all the answers.

    Maybe it can reply in a sexy voice too? (I've never used it so don't
    know if it can talk.)

    its shocking you never used it it is totally amazing in coding...

    overally ai is quite shocking but in coding its double..

    you simply say "write me procedure for that and that "and she odes it..

    a bit more troublesome may be if you tell it to write whole program as
    in my experience for big doses of code at once the probability to have
    soem mistakes seem to increase

    (im not much sure though as i usually want it to write pieces of code
    not whole programs

    its absolutely medevial today not to use it
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul@nospam@needed.invalid to comp.lang.c on Mon Sep 28 04:27:46 2026
    From Newsgroup: comp.lang.c

    On Sun, 9/27/2026 7:44 PM, bart wrote:
    On 27/09/2026 23:05, Chris M. Thomasson wrote:
    On 9/24/2026 5:05 PM, fir wrote:
    Chris M. Thomasson pisze:
    On 9/24/2026 7:45 AM, fir wrote:
    bart pisze:
    On 24/09/2026 14:36, fir wrote:
    i once was writing on this -

    #define _WIN32_WINNT 0x0501
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include <Mmsystem.h>
    #include<math.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include <stdint.h>

    #include "green-fire.h"

    What's the point of posting a 1200-line program without the headers and any other dependencies needed to compile it?

    In any case, you should be posting links to github etc for programs this big.

    int LoadBitmap(const char *filename, Bitmap *b)
    {

    This clashes with LoadBitmap from windows.h (where it is an alias for LoadBitmapA). It has a different signature.

    How did you manage to get this to compile? Is there some magic in green-fire.h that makes it possible?


    i dont know its ai generated and just work

    PUKE!

    [...]

    i asked ai for answer:

    PUKE!
    What a magnificent contribution to the discussion.
    I can see you're a man of deep technical insight rCo AI bad, therefore puke.
    Do try to contain yourself, old chap. The machines are coming anyway.

    How long have you been on this group rambling about C?

    Yeah, maybe he should be having more dialogues with AI than here, as it (she?) seems to have all the answers.

    Maybe it can reply in a sexy voice too? (I've never used it so don't know if it can talk.)

    Look for the microphone icon in the lower right corner of the interface.
    In some scenarios, speech will be available.

    An LLM-AI has the ability to mimic a users own voice. That makes
    the voice capability "very sexy".

    *******

    Even if you never intend to work with LLM-AI, at least for the
    agentic ones, you should know that

    stop

    stops the current operation. DO NOT use more words than that.
    Just the one word. That's suited to situations where you
    notice the agentic LLM-AI is deleting all your local files :-)

    Paul
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to comp.lang.c on Thu Oct 1 00:08:32 2026
    From Newsgroup: comp.lang.c

    On 9/24/2026 9:36 PM, fir wrote:
    i once was writing on this -
    the idea is take bitmap (like 960x540) take some pixels of it
    (in practice i take liek 2% maybe 5% random pixels store it as a file
    (new image codec) and interpolate it to recreate the image

    i just wonder how it would work..
    it was a bit to tedious to write it alone but in present times you just
    say it to chat gpt and it practically write it to yourself

    Dear fir,

    I have a copy of the 1993 /JPEG/ book. You know, the one that explains
    the standard, and the image manipulation behind it. Please forgive me
    for not just quoting the entire book.

    Anyway, the reason I bring it up is, if you try to code an image codec
    with ChatGPT, what are the chances [1] it'll just spew JPEG at you? And
    if you haven't read the book, would you know it?


    Best wishes, and happy image codecs!

    [1] This is a rhetorical question, I have no interest in the actual sta- tistics.
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
    Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
    --- Synchronet 3.22a-Linux NewsLink 1.2