[FFmpeg-devel] [PATCH] avfilter: compress CUDA PTX code if possible

Timo Rothenpieler timo at rothenpieler.org
Sat Jun 12 02:11:42 EEST 2021


On 12.06.2021 00:42, Timo Rothenpieler wrote:
> +#include <unistd.h>
> +#include <string.h>
> +#include <stdio.h>
> +
> +int main(int argc, char **argv)
> +{
> +    const char *name = NULL;
> +    unsigned int length = 0;
> +    unsigned char data;
> +
> +    if (argc != 2) {
> +        return 1;
> +    } else {
> +        int arglen = strlen(argv[1]);
> +        name = argv[1];
> +
> +        for (int i = 0; i < arglen; i++) {
> +            if (argv[1][i] == '.')
> +                argv[1][i] = '_';
> +            else if (argv[1][i] == '/')
> +                name = &argv[1][i+1];
> +        }
> +    }
> +
> +    printf("const unsigned char ff_%s_data[] = { ", name);
> +
> +    while (read(STDIN_FILENO, &data, 1)) {
> +        printf("0x%02x, ", data);
> +        length++;
> +    }
> +
> +    printf("0x00 };\n");
> +    printf("const unsigned int ff_%s_len = %u;\n", name, length);
> +
> +    return 0;
> +}

Just discovered that this doesn't work properly on MSVC.
Replaced locally with a variant based on freopen()/fread().

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4494 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210612/ff9d1863/attachment.bin>


More information about the ffmpeg-devel mailing list