• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/tableprint.h

Go to the documentation of this file.
00001 /*
00002  * Generate a file for hardcoded tables
00003  *
00004  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
00005  *
00006  * This file is part of FFmpeg.
00007  *
00008  * FFmpeg is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * FFmpeg is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with FFmpeg; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 #ifndef AVCODEC_TABLEPRINT_H
00024 #define AVCODEC_TABLEPRINT_H
00025 
00026 #include <stdint.h>
00027 #include <stdio.h>
00028 
00029 #define WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, ...)\
00030 void write_##name##_array(const type *data, int len)\
00031 {\
00032     int i;\
00033     printf("   ");\
00034     for (i = 0; i < len - 1; i++) {\
00035        printf(" "fmtstr",", __VA_ARGS__);\
00036        if ((i & linebrk) == linebrk) printf("\n   ");\
00037     }\
00038     printf(" "fmtstr"\n", __VA_ARGS__);\
00039 }
00040 
00041 #define WRITE_1D_FUNC(name, type, fmtstr, linebrk)\
00042     WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, data[i])
00043 
00044 #define WRITE_2D_FUNC(name, type)\
00045 void write_##name##_2d_array(const void *arg, int len, int len2)\
00046 {\
00047     const type *data = arg;\
00048     int i;\
00049     printf("    {\n");\
00050     for (i = 0; i < len; i++) {\
00051         write_##name##_array(data + i * len2, len2);\
00052         printf(i == len - 1 ? "    }\n" : "    }, {\n");\
00053     }\
00054 }
00055 
00061 void write_int8_array     (const int8_t   *, int);
00062 void write_uint8_array    (const uint8_t  *, int);
00063 void write_uint16_array   (const uint16_t *, int);
00064 void write_uint32_array   (const uint32_t *, int);
00065 void write_float_array    (const float    *, int);
00066 void write_int8_2d_array  (const void *, int, int);
00067 void write_uint8_2d_array (const void *, int, int);
00068 void write_uint32_2d_array(const void *, int, int); // end of printfuncs group
00070 
00072 void write_fileheader(void);
00073 
00074 #endif /* AVCODEC_TABLEPRINT_H */

Generated on Fri Sep 16 2011 17:17:43 for FFmpeg by  doxygen 1.7.1