2014-09-07 14:55:23 +03:00
|
|
|
/*
|
|
|
|
* Helpers for generating hard-coded VLC tables
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVCODEC_TABLEPRINT_VLC_H
|
|
|
|
#define AVCODEC_TABLEPRINT_VLC_H
|
|
|
|
|
|
|
|
#define AVUTIL_LOG_H
|
2015-05-07 00:52:47 +02:00
|
|
|
#define av_log(a, ...) while(0)
|
|
|
|
#define ff_dlog(a, ...) while(0)
|
2014-09-07 14:55:23 +03:00
|
|
|
#define AVUTIL_MEM_H
|
|
|
|
#define av_malloc(s) NULL
|
|
|
|
#define av_malloc_array(a, b) NULL
|
|
|
|
#define av_realloc_f(p, o, n) NULL
|
2015-05-07 00:52:47 +02:00
|
|
|
#define av_free(p) while(0)
|
|
|
|
#define av_freep(p) while(0)
|
2021-07-23 01:00:13 +02:00
|
|
|
#define AVUTIL_INTERNAL_H
|
2019-06-19 13:41:01 +02:00
|
|
|
#define avpriv_request_sample(...)
|
2014-09-07 14:55:23 +03:00
|
|
|
#include "tableprint.h"
|
2021-07-23 17:50:51 +02:00
|
|
|
#include "vlc.h"
|
2015-08-12 11:36:38 +02:00
|
|
|
#include "libavutil/reverse.c"
|
2022-03-17 12:33:02 +02:00
|
|
|
#include "vlc.c"
|
2014-09-07 14:55:23 +03:00
|
|
|
|
2022-06-13 23:02:57 +02:00
|
|
|
// The following will have to be modified if VLCBaseType changes.
|
|
|
|
WRITE_1D_FUNC_ARGV(VLCElem, 3, "{ .sym =%5" PRId16 ", .len =%2"PRIi16 " }",
|
|
|
|
data[i].sym, data[i].len)
|
2014-09-07 14:55:23 +03:00
|
|
|
|
2022-06-13 23:02:57 +02:00
|
|
|
static void write_vlc_type(const VLC *vlc, const VLCElem *base_table, const char *base_table_name)
|
2014-09-07 14:55:23 +03:00
|
|
|
{
|
|
|
|
printf(" .bits = %i,\n", vlc->bits);
|
|
|
|
// Unfortunately need to cast away const currently
|
2022-06-13 23:02:57 +02:00
|
|
|
printf(" .table = (VLCElem *)(%s + 0x%x),\n", base_table_name, (int)(vlc->table - base_table));
|
2014-09-07 14:55:23 +03:00
|
|
|
printf(" .table_size = 0x%x,\n", vlc->table_size);
|
|
|
|
printf(" .table_allocated = 0x%x,\n", vlc->table_allocated);
|
|
|
|
}
|
|
|
|
|
2022-06-13 23:02:57 +02:00
|
|
|
#define WRITE_VLC_TABLE(prefix, name) \
|
|
|
|
WRITE_ARRAY(prefix, VLCElem, name)
|
|
|
|
|
2014-09-07 14:55:23 +03:00
|
|
|
#define WRITE_VLC_TYPE(prefix, name, base_table) \
|
|
|
|
do { \
|
|
|
|
printf(prefix" VLC "#name" = {\n"); \
|
|
|
|
write_vlc_type(&name, base_table, #base_table); \
|
|
|
|
printf("};\n"); \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define WRITE_VLC_ARRAY(prefix, name, base_table) \
|
|
|
|
do { \
|
|
|
|
int i; \
|
|
|
|
const size_t array_size = FF_ARRAY_ELEMS(name); \
|
|
|
|
printf(prefix" VLC "#name"[%"FMT"] = {{\n", \
|
|
|
|
array_size); \
|
|
|
|
for (i = 0; i < array_size; i++) { \
|
|
|
|
write_vlc_type(name + i, \
|
|
|
|
base_table, #base_table); \
|
|
|
|
if (i != array_size - 1) printf("}, {\n"); \
|
|
|
|
} \
|
|
|
|
printf("}};\n"); \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#endif /* AVCODEC_TABLEPRINT_VLC_H */
|