FFmpeg
cdgraphics.c
Go to the documentation of this file.
1 /*
2  * CD Graphics Video Decoder
3  * Copyright (c) 2009 Michael Tison
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "avcodec.h"
23 #include "bytestream.h"
24 #include "codec_internal.h"
25 #include "decode.h"
26 
27 /**
28  * @file
29  * @brief CD Graphics Video Decoder
30  * @author Michael Tison
31  * @see http://wiki.multimedia.cx/index.php?title=CD_Graphics
32  * @see http://www.ccs.neu.edu/home/bchafy/cdb/info/cdg
33  */
34 
35 /// default screen sizes
36 #define CDG_FULL_WIDTH 300
37 #define CDG_FULL_HEIGHT 216
38 #define CDG_DISPLAY_WIDTH 294
39 #define CDG_DISPLAY_HEIGHT 204
40 #define CDG_BORDER_WIDTH 6
41 #define CDG_BORDER_HEIGHT 12
42 
43 /// masks
44 #define CDG_COMMAND 0x09
45 #define CDG_MASK 0x3F
46 
47 /// instruction codes
48 #define CDG_INST_MEMORY_PRESET 1
49 #define CDG_INST_BORDER_PRESET 2
50 #define CDG_INST_TILE_BLOCK 6
51 #define CDG_INST_SCROLL_PRESET 20
52 #define CDG_INST_SCROLL_COPY 24
53 #define CDG_INST_TRANSPARENT_COL 28
54 #define CDG_INST_LOAD_PAL_LO 30
55 #define CDG_INST_LOAD_PAL_HIGH 31
56 #define CDG_INST_TILE_BLOCK_XOR 38
57 
58 /// data sizes
59 #define CDG_PACKET_SIZE 24
60 #define CDG_DATA_SIZE 16
61 #define CDG_TILE_HEIGHT 12
62 #define CDG_TILE_WIDTH 6
63 #define CDG_MINIMUM_PKT_SIZE 6
64 #define CDG_MINIMUM_SCROLL_SIZE 3
65 #define CDG_HEADER_SIZE 8
66 #define CDG_PALETTE_SIZE 16
67 
68 typedef struct CDGraphicsContext {
70  int hscroll;
71  int vscroll;
73  int cleared;
75 
77 {
78  CDGraphicsContext *cc = avctx->priv_data;
79 
80  cc->frame = av_frame_alloc();
81  if (!cc->frame)
82  return AVERROR(ENOMEM);
83 
84  for (int i = 0; i < CDG_PALETTE_SIZE; i++)
85  cc->alpha[i] = 0xFFU;
86 
87  avctx->pix_fmt = AV_PIX_FMT_PAL8;
89 }
90 
91 static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
92 {
93  ptrdiff_t lsize = cc->frame->linesize[0];
94  uint8_t *buf = cc->frame->data[0];
95  int color = data[0] & 0x0F;
96 
97  if (!(data[1] & 0x0F)) {
98  /// fill the top and bottom borders
99  for (int y = 0; y < CDG_BORDER_HEIGHT; y++)
100  memset(buf + y * lsize, color, cc->frame->width);
101  for (int y = CDG_FULL_HEIGHT-CDG_BORDER_HEIGHT; y < CDG_FULL_HEIGHT; y++)
102  memset(buf + y * lsize, color, cc->frame->width);
103 
104  /// fill the side borders
105  for (int y = CDG_BORDER_HEIGHT; y < CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT; y++) {
106  memset(buf + y * lsize, color, CDG_BORDER_WIDTH);
107  memset(buf + CDG_FULL_WIDTH - CDG_BORDER_WIDTH + y * lsize,
109  }
110  }
111 }
112 
113 static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
114 {
115  uint8_t r, g, b;
116  uint16_t color;
117  int i;
118  int array_offset = low ? 0 : 8;
119  uint32_t *palette = (uint32_t *) cc->frame->data[1];
120 
121  for (i = 0; i < 8; i++) {
122  color = (data[2 * i] << 6) + (data[2 * i + 1] & 0x3F);
123  r = ((color >> 8) & 0x000F) * 17;
124  g = ((color >> 4) & 0x000F) * 17;
125  b = ((color ) & 0x000F) * 17;
126  palette[i + array_offset] = (uint32_t)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b;
127  }
128 #if FF_API_PALETTE_HAS_CHANGED
130  cc->frame->palette_has_changed = 1;
132 #endif
133 }
134 
135 static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)
136 {
137  unsigned ci, ri;
138  int color;
139  int x, y;
140  int ai;
141  ptrdiff_t stride = cc->frame->linesize[0];
142  uint8_t *buf = cc->frame->data[0];
143 
144  ri = (data[2] & 0x1F) * CDG_TILE_HEIGHT + cc->vscroll;
145  ci = (data[3] & 0x3F) * CDG_TILE_WIDTH + cc->hscroll;
146 
147  if (ri > (CDG_FULL_HEIGHT - CDG_TILE_HEIGHT))
148  return AVERROR(EINVAL);
149  if (ci > (CDG_FULL_WIDTH - CDG_TILE_WIDTH))
150  return AVERROR(EINVAL);
151 
152  for (y = 0; y < CDG_TILE_HEIGHT; y++) {
153  for (x = 0; x < CDG_TILE_WIDTH; x++) {
154  if (!((data[4 + y] >> (5 - x)) & 0x01))
155  color = data[0] & 0x0F;
156  else
157  color = data[1] & 0x0F;
158 
159  ai = ci + x + (stride * (ri + y));
160  if (b)
161  color ^= buf[ai];
162  buf[ai] = color;
163  }
164  }
165 
166  return 0;
167 }
168 
169 #define UP 2
170 #define DOWN 1
171 #define LEFT 2
172 #define RIGHT 1
173 
174 static void cdg_copy_rect_buf(int out_tl_x, int out_tl_y, uint8_t *out,
175  int in_tl_x, int in_tl_y, uint8_t *in,
176  int w, int h, int stride)
177 {
178  int y;
179 
180  in += in_tl_x + in_tl_y * stride;
181  out += out_tl_x + out_tl_y * stride;
182  for (y = 0; y < h; y++)
183  memcpy(out + y * stride, in + y * stride, w);
184 }
185 
186 static void cdg_fill_rect_preset(int tl_x, int tl_y, uint8_t *out,
187  int color, int w, int h, int stride)
188 {
189  int y;
190 
191  for (y = tl_y; y < tl_y + h; y++)
192  memset(out + tl_x + y * stride, color, w);
193 }
194 
195 static void cdg_fill_wrapper(int out_tl_x, int out_tl_y, uint8_t *out,
196  int in_tl_x, int in_tl_y, uint8_t *in,
197  int color, int w, int h, int stride, int roll)
198 {
199  if (roll) {
200  cdg_copy_rect_buf(out_tl_x, out_tl_y, out, in_tl_x, in_tl_y,
201  in, w, h, stride);
202  } else {
203  cdg_fill_rect_preset(out_tl_x, out_tl_y, out, color, w, h, stride);
204  }
205 }
206 
207 static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
208  AVFrame *new_frame, int roll_over)
209 {
210  int color;
211  int hscmd, h_off, hinc, vscmd, v_off, vinc;
212  int y;
213  ptrdiff_t stride = cc->frame->linesize[0];
214  uint8_t *in = cc->frame->data[0];
215  uint8_t *out = new_frame->data[0];
216 
217  color = data[0] & 0x0F;
218  hscmd = (data[1] & 0x30) >> 4;
219  vscmd = (data[2] & 0x30) >> 4;
220 
221  h_off = FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH - 1);
222  v_off = FFMIN(data[2] & 0x0F, CDG_BORDER_HEIGHT - 1);
223 
224  /// find the difference and save the offset for cdg_tile_block usage
225  hinc = h_off - cc->hscroll;
226  vinc = cc->vscroll - v_off;
227  cc->hscroll = h_off;
228  cc->vscroll = v_off;
229 
230  if (vscmd == UP)
231  vinc -= 12;
232  if (vscmd == DOWN)
233  vinc += 12;
234  if (hscmd == LEFT)
235  hinc -= 6;
236  if (hscmd == RIGHT)
237  hinc += 6;
238 
239  if (!hinc && !vinc)
240  return;
241 
242  memcpy(new_frame->data[1], cc->frame->data[1], CDG_PALETTE_SIZE * 4);
243 
244  for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++)
245  memcpy(out + FFMAX(0, hinc) + stride * y,
246  in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
247  FFABS(stride) - FFABS(hinc));
248 
249  if (vinc > 0)
250  cdg_fill_wrapper(0, 0, out,
251  0, CDG_FULL_HEIGHT - vinc, in, color,
252  FFABS(stride), vinc, stride, roll_over);
253  else if (vinc < 0)
255  0, 0, in, color,
256  FFABS(stride), -1 * vinc, stride, roll_over);
257 
258  if (hinc > 0)
259  cdg_fill_wrapper(0, 0, out,
260  CDG_FULL_WIDTH - hinc, 0, in, color,
261  hinc, CDG_FULL_HEIGHT, stride, roll_over);
262  else if (hinc < 0)
264  0, 0, in, color,
265  -1 * hinc, CDG_FULL_HEIGHT, stride, roll_over);
266 
267 }
268 
270  int *got_frame, AVPacket *avpkt)
271 {
272  GetByteContext gb;
273  int buf_size = avpkt->size;
274  int ret;
275  uint8_t command, inst;
276  uint8_t cdg_data[CDG_DATA_SIZE] = {0};
277  CDGraphicsContext *cc = avctx->priv_data;
278 
279  if (buf_size < CDG_MINIMUM_PKT_SIZE) {
280  av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n");
281  return AVERROR(EINVAL);
282  }
283  if (buf_size > CDG_HEADER_SIZE + CDG_DATA_SIZE) {
284  av_log(avctx, AV_LOG_ERROR, "buffer too big for decoder\n");
285  return AVERROR(EINVAL);
286  }
287 
288  bytestream2_init(&gb, avpkt->data, avpkt->size);
289 
290  if ((ret = ff_reget_buffer(avctx, cc->frame, 0)) < 0)
291  return ret;
292  if (!cc->cleared) {
293  for (int y = 0; y < avctx->height; y++)
294  memset(cc->frame->data[0] + y * cc->frame->linesize[0], 0, avctx->width);
295  memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
296  cc->cleared = 1;
297  }
298 
299  command = bytestream2_get_byte(&gb);
300  inst = bytestream2_get_byte(&gb);
301  inst &= CDG_MASK;
302  bytestream2_skip(&gb, 2);
303  bytestream2_get_buffer(&gb, cdg_data, sizeof(cdg_data));
304 
305  if ((command & CDG_MASK) == CDG_COMMAND) {
306  switch (inst) {
308  if (!(cdg_data[1] & 0x0F)) {
309  for (int y = 0; y < avctx->height; y++)
310  memset(cc->frame->data[0] + y * cc->frame->linesize[0],
311  cdg_data[0] & 0x0F, avctx->width);
312  }
313  break;
316  if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
317  av_log(avctx, AV_LOG_ERROR, "buffer too small for loading palette\n");
318  return AVERROR(EINVAL);
319  }
320 
321  cdg_load_palette(cc, cdg_data, inst == CDG_INST_LOAD_PAL_LO);
322  break;
324  cdg_border_preset(cc, cdg_data);
325  break;
327  case CDG_INST_TILE_BLOCK:
328  if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
329  av_log(avctx, AV_LOG_ERROR, "buffer too small for drawing tile\n");
330  return AVERROR(EINVAL);
331  }
332 
333  ret = cdg_tile_block(cc, cdg_data, inst == CDG_INST_TILE_BLOCK_XOR);
334  if (ret) {
335  av_log(avctx, AV_LOG_ERROR, "tile is out of range\n");
336  return ret;
337  }
338  break;
341  if (buf_size - CDG_HEADER_SIZE < CDG_MINIMUM_SCROLL_SIZE) {
342  av_log(avctx, AV_LOG_ERROR, "buffer too small for scrolling\n");
343  return AVERROR(EINVAL);
344  }
345 
346  if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
347  return ret;
348 
349  cdg_scroll(cc, cdg_data, frame, inst == CDG_INST_SCROLL_COPY);
351  if (ret < 0)
352  return ret;
353  break;
355  for (int i = 0; i < CDG_PALETTE_SIZE; i++)
356  cc->alpha[i] = 255 - ((cdg_data[i] & 0x3f) << 2);
357  break;
358  default:
359  break;
360  }
361 
362  if (!frame->data[0]) {
363  ret = av_frame_ref(frame, cc->frame);
364  if (ret < 0)
365  return ret;
366  }
367  *got_frame = 1;
368  } else {
369  *got_frame = 0;
370  }
371 
372  return avpkt->size;
373 }
374 
375 static void cdg_decode_flush(AVCodecContext *avctx)
376 {
377  CDGraphicsContext *cc = avctx->priv_data;
378 
379  if (!cc->frame->data[0])
380  return;
381 
382  for (int y = 0; y < avctx->height; y++)
383  memset(cc->frame->data[0] + y * cc->frame->linesize[0], 0, avctx->width);
384  if (!avctx->frame_num)
385  memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
386 }
387 
389 {
390  CDGraphicsContext *cc = avctx->priv_data;
391 
392  av_frame_free(&cc->frame);
393 
394  return 0;
395 }
396 
398  .p.name = "cdgraphics",
399  CODEC_LONG_NAME("CD Graphics video"),
400  .p.type = AVMEDIA_TYPE_VIDEO,
401  .p.id = AV_CODEC_ID_CDGRAPHICS,
402  .priv_data_size = sizeof(CDGraphicsContext),
404  .close = cdg_decode_end,
406  .flush = cdg_decode_flush,
407  .p.capabilities = AV_CODEC_CAP_DR1,
408 };
cdg_scroll
static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data, AVFrame *new_frame, int roll_over)
Definition: cdgraphics.c:207
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
r
const char * r
Definition: vf_curves.c:126
AVFrame::palette_has_changed
attribute_deprecated int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:533
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
cdg_decode_frame
static int cdg_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: cdgraphics.c:269
out
FILE * out
Definition: movenc.c:54
color
Definition: vf_paletteuse.c:511
GetByteContext
Definition: bytestream.h:33
CDG_INST_SCROLL_PRESET
#define CDG_INST_SCROLL_PRESET
Definition: cdgraphics.c:51
CDG_DATA_SIZE
#define CDG_DATA_SIZE
Definition: cdgraphics.c:60
CDG_INST_LOAD_PAL_HIGH
#define CDG_INST_LOAD_PAL_HIGH
Definition: cdgraphics.c:55
CDGraphicsContext::alpha
uint8_t alpha[CDG_PALETTE_SIZE]
Definition: cdgraphics.c:72
CDG_MINIMUM_PKT_SIZE
#define CDG_MINIMUM_PKT_SIZE
Definition: cdgraphics.c:63
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:88
CDG_INST_TRANSPARENT_COL
#define CDG_INST_TRANSPARENT_COL
Definition: cdgraphics.c:53
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
AVFrame::width
int width
Definition: frame.h:412
w
uint8_t w
Definition: llviddspenc.c:38
AVPacket::data
uint8_t * data
Definition: packet.h:522
b
#define b
Definition: input.c:41
CDGraphicsContext::frame
AVFrame * frame
Definition: cdgraphics.c:69
data
const char data[16]
Definition: mxf.c:148
cdg_tile_block
static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)
Definition: cdgraphics.c:135
FFCodec
Definition: codec_internal.h:127
CDG_TILE_WIDTH
#define CDG_TILE_WIDTH
Definition: cdgraphics.c:62
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
CDG_MASK
#define CDG_MASK
Definition: cdgraphics.c:45
CDG_INST_TILE_BLOCK_XOR
#define CDG_INST_TILE_BLOCK_XOR
Definition: cdgraphics.c:56
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:94
DOWN
#define DOWN
Definition: cdgraphics.c:170
CDG_PALETTE_SIZE
#define CDG_PALETTE_SIZE
Definition: cdgraphics.c:66
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:361
bytestream2_skip
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:168
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
CDG_FULL_HEIGHT
#define CDG_FULL_HEIGHT
Definition: cdgraphics.c:37
CDG_HEADER_SIZE
#define CDG_HEADER_SIZE
Definition: cdgraphics.c:65
cdg_decode_flush
static void cdg_decode_flush(AVCodecContext *avctx)
Definition: cdgraphics.c:375
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:76
cdg_border_preset
static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
Definition: cdgraphics.c:91
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
cdg_decode_init
static av_cold int cdg_decode_init(AVCodecContext *avctx)
Definition: cdgraphics.c:76
CDG_BORDER_HEIGHT
#define CDG_BORDER_HEIGHT
Definition: cdgraphics.c:41
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
g
const char * g
Definition: vf_curves.c:127
AV_GET_BUFFER_FLAG_REF
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
Definition: avcodec.h:425
CDGraphicsContext::vscroll
int vscroll
Definition: cdgraphics.c:71
decode.h
command
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Definition: vf_drawtext.c:1185
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
CDG_MINIMUM_SCROLL_SIZE
#define CDG_MINIMUM_SCROLL_SIZE
Definition: cdgraphics.c:64
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
CDG_FULL_WIDTH
#define CDG_FULL_WIDTH
default screen sizes
Definition: cdgraphics.c:36
ff_cdgraphics_decoder
const FFCodec ff_cdgraphics_decoder
Definition: cdgraphics.c:397
cdg_copy_rect_buf
static void cdg_copy_rect_buf(int out_tl_x, int out_tl_y, uint8_t *out, int in_tl_x, int in_tl_y, uint8_t *in, int w, int h, int stride)
Definition: cdgraphics.c:174
CDG_COMMAND
#define CDG_COMMAND
masks
Definition: cdgraphics.c:44
UP
#define UP
Definition: cdgraphics.c:169
AVPALETTE_SIZE
#define AVPALETTE_SIZE
Definition: pixfmt.h:32
bytestream2_get_buffer
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:267
cdg_load_palette
static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
Definition: cdgraphics.c:113
cdg_decode_end
static av_cold int cdg_decode_end(AVCodecContext *avctx)
Definition: cdgraphics.c:388
AV_CODEC_ID_CDGRAPHICS
@ AV_CODEC_ID_CDGRAPHICS
Definition: codec_id.h:184
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1568
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:523
av_frame_ref
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:312
codec_internal.h
RIGHT
#define RIGHT
Definition: cdgraphics.c:172
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
color
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:94
LEFT
#define LEFT
Definition: cdgraphics.c:171
CDG_INST_TILE_BLOCK
#define CDG_INST_TILE_BLOCK
Definition: cdgraphics.c:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
CDG_INST_BORDER_PRESET
#define CDG_INST_BORDER_PRESET
Definition: cdgraphics.c:49
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
CDG_INST_SCROLL_COPY
#define CDG_INST_SCROLL_COPY
Definition: cdgraphics.c:52
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::height
int height
Definition: avcodec.h:618
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
avcodec.h
stride
#define stride
Definition: h264pred_template.c:537
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AVCodecContext::frame_num
int64_t frame_num
Frame counter, set by libavcodec.
Definition: avcodec.h:2030
ff_reget_buffer
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
Definition: decode.c:1677
ret
ret
Definition: filter_design.txt:187
CDGraphicsContext::hscroll
int hscroll
Definition: cdgraphics.c:70
CDG_BORDER_WIDTH
#define CDG_BORDER_WIDTH
Definition: cdgraphics.c:40
av_frame_replace
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
Definition: frame.c:411
AVCodecContext
main external API structure.
Definition: avcodec.h:445
CDG_TILE_HEIGHT
#define CDG_TILE_HEIGHT
Definition: cdgraphics.c:61
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
CDG_INST_MEMORY_PRESET
#define CDG_INST_MEMORY_PRESET
instruction codes
Definition: cdgraphics.c:48
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
CDGraphicsContext
Definition: cdgraphics.c:68
cdg_fill_rect_preset
static void cdg_fill_rect_preset(int tl_x, int tl_y, uint8_t *out, int color, int w, int h, int stride)
Definition: cdgraphics.c:186
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
bytestream.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:385
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
h
h
Definition: vp9dsp_template.c:2038
CDG_INST_LOAD_PAL_LO
#define CDG_INST_LOAD_PAL_LO
Definition: cdgraphics.c:54
CDGraphicsContext::cleared
int cleared
Definition: cdgraphics.c:73
cdg_fill_wrapper
static void cdg_fill_wrapper(int out_tl_x, int out_tl_y, uint8_t *out, int in_tl_x, int in_tl_y, uint8_t *in, int color, int w, int h, int stride, int roll)
Definition: cdgraphics.c:195