1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 /**
20 * @file
21 * Display frame palette (AV_PIX_FMT_PAL8)
22 */
23
30
35
36 #define OFFSET(x) offsetof(ShowPaletteContext, x)
37 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
41 };
42
44
46 {
51 if (!in || !out) {
55 }
58 return 0;
59 }
60
62 {
65 outlink->
w = outlink->
h = 16 * s->
size;
66 return 0;
67 }
68
70 {
72 uint32_t *dst = (uint32_t *)out->
data[0];
73 const int dst_linesize = out->
linesize[0] >> 2;
74 const uint32_t *pal = (uint32_t *)in->
data[1];
75
76 for (y = 0; y < 16; y++)
77 for (x = 0; x < 16; x++)
78 for (j = 0; j <
size; j++)
79 for (i = 0; i <
size; i++)
80 dst[(y*dst_linesize + x) * size + j*dst_linesize + i] = pal[y*16 + x];
81 return 0;
82 }
83
85 {
91
93 if (!out) {
96 }
101 }
102
104 {
108 },
110 };
111
113 {
117 },
119 };
120
122 .
name =
"showpalette",
126 .
inputs = showpalette_inputs,
127 .
outputs = showpalette_outputs,
128 .priv_class = &showpalette_class,
130 };