FFmpeg
dxvenc.c
Go to the documentation of this file.
1 /*
2  * Resolume DXV encoder
3  * Copyright (C) 2024 Connor Worley <connorbworley@gmail.com>
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 <stdint.h>
23 
24 #include "libavutil/crc.h"
25 #include "libavutil/imgutils.h"
26 #include "libavutil/mem.h"
27 #include "libavutil/opt.h"
28 
29 #include "bytestream.h"
30 #include "codec_internal.h"
31 #include "dxv.h"
32 #include "encode.h"
33 #include "texturedsp.h"
34 
35 #define DXV_HEADER_LENGTH 12
36 
37 /*
38  * DXV uses LZ-like back-references to avoid copying words that have already
39  * appeared in the decompressed stream. Using a simple hash table (HT)
40  * significantly speeds up the lookback process while encoding.
41  */
42 #define LOOKBACK_HT_ELEMS 0x40000
43 #define LOOKBACK_WORDS 0x20202
44 
45 typedef struct HTEntry {
46  uint32_t key;
47  uint32_t pos;
48 } HTEntry;
49 
50 static void ht_init(HTEntry *ht)
51 {
52  for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
53  ht[i].pos = -1;
54  }
55 }
56 
57 static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
58  uint32_t key, uint32_t pos)
59 {
60  uint32_t ret = -1;
61  size_t hash = av_crc(hash_ctx, 0, (uint8_t*)&key, 4) % LOOKBACK_HT_ELEMS;
62  for (size_t i = hash; i < hash + LOOKBACK_HT_ELEMS; i++) {
63  size_t wrapped_index = i % LOOKBACK_HT_ELEMS;
64  HTEntry *entry = &ht[wrapped_index];
65  if (entry->key == key || entry->pos == -1) {
66  ret = entry->pos;
67  entry->key = key;
68  entry->pos = pos;
69  break;
70  }
71  }
72  return ret;
73 }
74 
75 static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
76  uint32_t key, uint32_t pos)
77 {
78  HTEntry *removed_entry = NULL;
79  size_t removed_hash;
80  size_t hash = av_crc(hash_ctx, 0, (uint8_t*)&key, 4) % LOOKBACK_HT_ELEMS;
81 
82  for (size_t i = hash; i < hash + LOOKBACK_HT_ELEMS; i++) {
83  size_t wrapped_index = i % LOOKBACK_HT_ELEMS;
84  HTEntry *entry = &ht[wrapped_index];
85  if (entry->pos == -1)
86  return;
87  if (removed_entry) {
88  size_t candidate_hash = av_crc(hash_ctx, 0, (uint8_t*)&entry->key, 4) % LOOKBACK_HT_ELEMS;
89  if ((wrapped_index > removed_hash && (candidate_hash <= removed_hash || candidate_hash > wrapped_index)) ||
90  (wrapped_index < removed_hash && (candidate_hash <= removed_hash && candidate_hash > wrapped_index))) {
91  *removed_entry = *entry;
92  entry->pos = -1;
93  removed_entry = entry;
94  removed_hash = wrapped_index;
95  }
96  } else if (entry->key == key) {
97  if (entry->pos <= pos) {
98  entry->pos = -1;
99  removed_entry = entry;
100  removed_hash = wrapped_index;
101  } else {
102  return;
103  }
104  }
105  }
106 }
107 
108 typedef struct DXVEncContext {
109  AVClass *class;
110 
112 
113  uint8_t *tex_data; // Compressed texture
114  int64_t tex_size; // Texture size
115 
116  /* Optimal number of slices for parallel decoding */
118 
120 
122  int (*compress_tex)(AVCodecContext *avctx);
123 
124  const AVCRC *crc_ctx;
125 
128 } DXVEncContext;
129 
130 /* Converts an index offset value to a 2-bit opcode and pushes it to a stream.
131  * Inverse of CHECKPOINT in dxv.c. */
132 #define PUSH_OP(x) \
133  do { \
134  if (state == 16) { \
135  if (bytestream2_get_bytes_left_p(pbc) < 4) { \
136  return AVERROR_INVALIDDATA; \
137  } \
138  value = pbc->buffer; \
139  bytestream2_put_le32(pbc, 0); \
140  state = 0; \
141  } \
142  if (idx >= 0x102 * x) { \
143  op = 3; \
144  bytestream2_put_le16(pbc, (idx / x) - 0x102); \
145  } else if (idx >= 2 * x) { \
146  op = 2; \
147  bytestream2_put_byte(pbc, (idx / x) - 2); \
148  } else if (idx == x) { \
149  op = 1; \
150  } else { \
151  op = 0; \
152  } \
153  AV_WL32(value, AV_RL32(value) | (op << (state * 2))); \
154  state++; \
155  } while (0)
156 
158 {
159  DXVEncContext *ctx = avctx->priv_data;
160  PutByteContext *pbc = &ctx->pbc;
161  void *value;
162  uint32_t color, lut, idx, color_idx, lut_idx, prev_pos, state = 16, pos = 2, op = 0;
163 
164  ht_init(ctx->color_lookback_ht);
165  ht_init(ctx->lut_lookback_ht);
166 
167  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data));
168  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + 4));
169 
170  ht_lookup_and_upsert(ctx->color_lookback_ht, ctx->crc_ctx, AV_RL32(ctx->tex_data), 0);
171  ht_lookup_and_upsert(ctx->lut_lookback_ht, ctx->crc_ctx, AV_RL32(ctx->tex_data + 4), 1);
172 
173  while (pos + 2 <= ctx->tex_size / 4) {
174  idx = 0;
175 
176  color = AV_RL32(ctx->tex_data + pos * 4);
177  prev_pos = ht_lookup_and_upsert(ctx->color_lookback_ht, ctx->crc_ctx, color, pos);
178  color_idx = prev_pos != -1 ? pos - prev_pos : 0;
179  if (pos >= LOOKBACK_WORDS) {
180  uint32_t old_pos = pos - LOOKBACK_WORDS;
181  uint32_t old_color = AV_RL32(ctx->tex_data + old_pos * 4);
182  ht_delete(ctx->color_lookback_ht, ctx->crc_ctx, old_color, old_pos);
183  }
184  pos++;
185 
186  lut = AV_RL32(ctx->tex_data + pos * 4);
187  if (color_idx && lut == AV_RL32(ctx->tex_data + (pos - color_idx) * 4)) {
188  idx = color_idx;
189  } else {
190  idx = 0;
191  prev_pos = ht_lookup_and_upsert(ctx->lut_lookback_ht, ctx->crc_ctx, lut, pos);
192  lut_idx = prev_pos != -1 ? pos - prev_pos : 0;
193  }
194  if (pos >= LOOKBACK_WORDS) {
195  uint32_t old_pos = pos - LOOKBACK_WORDS;
196  uint32_t old_lut = AV_RL32(ctx->tex_data + old_pos * 4);
197  ht_delete(ctx->lut_lookback_ht, ctx->crc_ctx, old_lut, old_pos);
198  }
199  pos++;
200 
201  PUSH_OP(2);
202 
203  if (!idx) {
204  idx = color_idx;
205  PUSH_OP(2);
206  if (!idx)
207  bytestream2_put_le32(pbc, color);
208 
209  idx = lut_idx;
210  PUSH_OP(2);
211  if (!idx)
212  bytestream2_put_le32(pbc, lut);
213  }
214  }
215 
216  return 0;
217 }
218 
219 static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
220  const AVFrame *frame, int *got_packet)
221 {
222  DXVEncContext *ctx = avctx->priv_data;
223  PutByteContext *pbc = &ctx->pbc;
224  int ret;
225 
226  /* unimplemented: needs to depend on compression ratio of tex format */
227  /* under DXT1, we need 3 words to encode load ops for 32 words.
228  * the first 2 words of the texture do not need load ops. */
229  ret = ff_alloc_packet(avctx, pkt, DXV_HEADER_LENGTH + ctx->tex_size + AV_CEIL_RSHIFT(ctx->tex_size - 8, 7) * 12);
230  if (ret < 0)
231  return ret;
232 
233  if (ctx->enc.tex_funct) {
234  ctx->enc.tex_data.out = ctx->tex_data;
235  ctx->enc.frame_data.in = frame->data[0];
236  ctx->enc.stride = frame->linesize[0];
237  ctx->enc.width = avctx->width;
238  ctx->enc.height = avctx->height;
240  } else {
241  /* unimplemented: YCoCg formats */
242  return AVERROR_INVALIDDATA;
243  }
244 
246 
247  bytestream2_put_le32(pbc, ctx->tex_fmt);
248  bytestream2_put_byte(pbc, 4);
249  bytestream2_put_byte(pbc, 0);
250  bytestream2_put_byte(pbc, 0);
251  bytestream2_put_byte(pbc, 0);
252  /* Fill in compressed size later */
253  bytestream2_skip_p(pbc, 4);
254 
255  ret = ctx->compress_tex(avctx);
256  if (ret < 0)
257  return ret;
258 
261 
262  *got_packet = 1;
263  return 0;
264 }
265 
266 static av_cold int dxv_init(AVCodecContext *avctx)
267 {
268  DXVEncContext *ctx = avctx->priv_data;
269  TextureDSPEncContext texdsp;
270  int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
271 
272  if (ret < 0) {
273  av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
274  avctx->width, avctx->height);
275  return ret;
276  }
277 
278  if (avctx->width % TEXTURE_BLOCK_W || avctx->height % TEXTURE_BLOCK_H) {
279  av_log(avctx,
280  AV_LOG_ERROR,
281  "Video size %dx%d is not multiple of "AV_STRINGIFY(TEXTURE_BLOCK_W)"x"AV_STRINGIFY(TEXTURE_BLOCK_H)".\n",
282  avctx->width, avctx->height);
283  return AVERROR_INVALIDDATA;
284  }
285 
286  ff_texturedspenc_init(&texdsp);
287 
288  switch (ctx->tex_fmt) {
289  case DXV_FMT_DXT1:
290  ctx->compress_tex = dxv_compress_dxt1;
291  ctx->enc.tex_funct = texdsp.dxt1_block;
292  ctx->enc.tex_ratio = 8;
293  break;
294  default:
295  av_log(avctx, AV_LOG_ERROR, "Invalid format %08X\n", ctx->tex_fmt);
296  return AVERROR_INVALIDDATA;
297  }
298  ctx->enc.raw_ratio = 16;
299  ctx->tex_size = avctx->width / TEXTURE_BLOCK_W *
300  avctx->height / TEXTURE_BLOCK_H *
301  ctx->enc.tex_ratio;
302  ctx->enc.slice_count = av_clip(avctx->thread_count, 1, avctx->height / TEXTURE_BLOCK_H);
303 
304  ctx->tex_data = av_malloc(ctx->tex_size);
305  if (!ctx->tex_data) {
306  return AVERROR(ENOMEM);
307  }
308 
309  ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
310  if (!ctx->crc_ctx) {
311  av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC table.\n");
312  return AVERROR_BUG;
313  }
314 
315  return 0;
316 }
317 
318 static av_cold int dxv_close(AVCodecContext *avctx)
319 {
320  DXVEncContext *ctx = avctx->priv_data;
321 
322  av_freep(&ctx->tex_data);
323 
324  return 0;
325 }
326 
327 #define OFFSET(x) offsetof(DXVEncContext, x)
328 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
329 static const AVOption options[] = {
330  { "format", NULL, OFFSET(tex_fmt), AV_OPT_TYPE_INT, { .i64 = DXV_FMT_DXT1 }, DXV_FMT_DXT1, DXV_FMT_DXT1, FLAGS, .unit = "format" },
331  { "dxt1", "DXT1 (Normal Quality, No Alpha)", 0, AV_OPT_TYPE_CONST, { .i64 = DXV_FMT_DXT1 }, 0, 0, FLAGS, .unit = "format" },
332  { NULL },
333 };
334 
335 static const AVClass dxvenc_class = {
336  .class_name = "DXV encoder",
337  .option = options,
338  .version = LIBAVUTIL_VERSION_INT,
339 };
340 
342  .p.name = "dxv",
343  CODEC_LONG_NAME("Resolume DXV"),
344  .p.type = AVMEDIA_TYPE_VIDEO,
345  .p.id = AV_CODEC_ID_DXV,
346  .init = dxv_init,
348  .close = dxv_close,
349  .priv_data_size = sizeof(DXVEncContext),
350  .p.capabilities = AV_CODEC_CAP_DR1 |
353  .p.priv_class = &dxvenc_class,
354  .p.pix_fmts = (const enum AVPixelFormat[]) {
356  },
357  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
358 };
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
DXV_FMT_DXT1
@ DXV_FMT_DXT1
Definition: dxv.h:28
entry
#define entry
Definition: aom_film_grain_template.c:66
av_clip
#define av_clip
Definition: common.h:100
DXVEncContext
Definition: dxvenc.c:108
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
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
opt.h
AV_WL32
#define AV_WL32(p, v)
Definition: intreadwrite.h:422
TEXTURE_BLOCK_H
#define TEXTURE_BLOCK_H
Definition: texturedsp.h:43
color
Definition: vf_paletteuse.c:513
AVCRC
uint32_t AVCRC
Definition: crc.h:46
dxvenc_class
static const AVClass dxvenc_class
Definition: dxvenc.c:335
int64_t
long long int64_t
Definition: coverity.c:34
ff_dxv_encoder
const FFCodec ff_dxv_encoder
Definition: dxvenc.c:341
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
HTEntry::pos
uint32_t pos
Definition: dxvenc.c:47
HTEntry
Definition: dxvenc.c:45
AVPacket::data
uint8_t * data
Definition: packet.h:539
TextureDSPEncContext
Definition: texturedsp.h:63
AVOption
AVOption.
Definition: opt.h:429
encode.h
bytestream2_tell_p
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
Definition: bytestream.h:197
OFFSET
#define OFFSET(x)
Definition: dxvenc.c:327
FFCodec
Definition: codec_internal.h:127
HTEntry::key
uint32_t key
Definition: dxvenc.c:46
hash
uint8_t hash[HASH_SIZE]
Definition: movenc.c:58
LOOKBACK_WORDS
#define LOOKBACK_WORDS
Definition: dxvenc.c:43
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
state
static struct @464 state
crc.h
DXVEncContext::lut_lookback_ht
HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS]
Definition: dxvenc.c:127
texturedsp.h
ff_texturedspenc_init
void ff_texturedspenc_init(TextureDSPEncContext *c)
Definition: texturedspenc.c:650
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:1593
av_shrink_packet
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
Definition: packet.c:113
DXVEncContext::enc
TextureDSPThreadContext enc
Definition: dxvenc.c:119
DXV_HEADER_LENGTH
#define DXV_HEADER_LENGTH
Definition: dxvenc.c:35
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
dxv_encode
static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: dxvenc.c:219
TextureDSPThreadContext
Definition: texturedsp.h:69
LOOKBACK_HT_ELEMS
#define LOOKBACK_HT_ELEMS
Definition: dxvenc.c:42
options
static const AVOption options[]
Definition: dxvenc.c:329
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
av_cold
#define av_cold
Definition: attributes.h:90
DXVEncContext::tex_data
uint8_t * tex_data
Definition: dxvenc.c:113
bytestream2_init_writer
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:147
DXVEncContext::color_lookback_ht
HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS]
Definition: dxvenc.c:126
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
op
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
Definition: anm.c:76
dxv_compress_dxt1
static int dxv_compress_dxt1(AVCodecContext *avctx)
Definition: dxvenc.c:157
DXVEncContext::crc_ctx
const AVCRC * crc_ctx
Definition: dxvenc.c:124
ctx
AVFormatContext * ctx
Definition: movenc.c:49
key
const char * key
Definition: hwcontext_opencl.c:189
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
DXVTextureFormat
DXVTextureFormat
Definition: dxv.h:27
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:110
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
DXVEncContext::slice_count
int slice_count
Definition: dxvenc.c:117
ht_lookup_and_upsert
static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx, uint32_t key, uint32_t pos)
Definition: dxvenc.c:57
dxv_close
static av_cold int dxv_close(AVCodecContext *avctx)
Definition: dxvenc.c:318
PutByteContext
Definition: bytestream.h:37
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:540
codec_internal.h
dxv_init
static av_cold int dxv_init(AVCodecContext *avctx)
Definition: dxvenc.c:266
AV_CODEC_ID_DXV
@ AV_CODEC_ID_DXV
Definition: codec_id.h:245
color
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:94
ff_texturedsp_exec_compress_threads
int ff_texturedsp_exec_compress_threads(struct AVCodecContext *avctx, TextureDSPThreadContext *ctx)
DXVEncContext::tex_size
int64_t tex_size
Definition: dxvenc.c:114
DXVEncContext::pbc
PutByteContext pbc
Definition: dxvenc.c:111
av_crc_get_table
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:374
AV_CODEC_CAP_SLICE_THREADS
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: codec.h:114
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
bytestream2_skip_p
static av_always_inline void bytestream2_skip_p(PutByteContext *p, unsigned int size)
Definition: bytestream.h:180
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
TEXTURE_BLOCK_W
#define TEXTURE_BLOCK_W
Definition: texturedsp.h:42
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
ht_init
static void ht_init(HTEntry *ht)
Definition: dxvenc.c:50
AV_CRC_32_IEEE
@ AV_CRC_32_IEEE
Definition: crc.h:52
AVCodecContext::height
int height
Definition: avcodec.h:624
FLAGS
#define FLAGS
Definition: dxvenc.c:328
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:80
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
DXVEncContext::tex_fmt
DXVTextureFormat tex_fmt
Definition: dxvenc.c:121
pos
unsigned int pos
Definition: spdifenc.c:414
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
ht_delete
static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx, uint32_t key, uint32_t pos)
Definition: dxvenc.c:75
AVCodecContext
main external API structure.
Definition: avcodec.h:451
TextureDSPEncContext::dxt1_block
int(* dxt1_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:64
av_crc
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
Definition: crc.c:392
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
PUSH_OP
#define PUSH_OP(x)
Definition: dxvenc.c:132
DXVEncContext::compress_tex
int(* compress_tex)(AVCodecContext *avctx)
Definition: dxvenc.c:122
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mem.h
dxv.h
AVPacket
This structure stores compressed data.
Definition: packet.h:516
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:478
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:624
bytestream.h
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
av_image_check_size
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
Definition: imgutils.c:318
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
ff_alloc_packet
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
Definition: encode.c:62