FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dxvenc.c
Go to the documentation of this file.
1 /*
2  * Resolume DXV encoder
3  * Copyright (C) 2024 Emma Worley <emma@emma.gg>
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 "libavcodec/hashtable.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  * Resolume will refuse to display frames that are not padded to 16x16 pixels.
39  */
40 #define DXV_ALIGN(x) FFALIGN(x, 16)
41 
42 /*
43  * DXV uses LZ-like back-references to avoid copying words that have already
44  * appeared in the decompressed stream. Using a simple hash table (HT)
45  * significantly speeds up the lookback process while encoding.
46  */
47 #define LOOKBACK_HT_ELEMS 0x20202
48 #define LOOKBACK_WORDS 0x20202
49 
50 typedef struct DXVEncContext {
51  AVClass *class;
52 
54 
55  uint8_t *tex_data; // Compressed texture
56  int64_t tex_size; // Texture size
57 
58  /* Optimal number of slices for parallel decoding */
60 
62 
64  int (*compress_tex)(AVCodecContext *avctx);
65 
70 
71 /* Converts an index offset value to a 2-bit opcode and pushes it to a stream.
72  * Inverse of CHECKPOINT in dxv.c. */
73 #define PUSH_OP(x) \
74  do { \
75  if (state == 16) { \
76  if (bytestream2_get_bytes_left_p(pbc) < 4) { \
77  return AVERROR_INVALIDDATA; \
78  } \
79  value = pbc->buffer; \
80  bytestream2_put_le32(pbc, 0); \
81  state = 0; \
82  } \
83  if (idx >= 0x102 * x) { \
84  op = 3; \
85  bytestream2_put_le16(pbc, (idx / x) - 0x102); \
86  } else if (idx >= 2 * x) { \
87  op = 2; \
88  bytestream2_put_byte(pbc, (idx / x) - 2); \
89  } else if (idx == x) { \
90  op = 1; \
91  } else { \
92  op = 0; \
93  } \
94  AV_WL32(value, AV_RL32(value) | (op << (state * 2))); \
95  state++; \
96  } while (0)
97 
99 {
100  DXVEncContext *ctx = avctx->priv_data;
101  PutByteContext *pbc = &ctx->pbc;
102  void *value;
103  uint32_t idx, combo_idx, prev_pos, old_pos, state = 16, pos = 0, op = 0;
104 
105  ff_hashtable_clear(ctx->color_ht);
106  ff_hashtable_clear(ctx->lut_ht);
107  ff_hashtable_clear(ctx->combo_ht);
108 
109  ff_hashtable_set(ctx->combo_ht, ctx->tex_data, &pos);
110 
111  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data));
112  ff_hashtable_set(ctx->color_ht, ctx->tex_data, &pos);
113  pos++;
114  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + 4));
115  ff_hashtable_set(ctx->lut_ht, ctx->tex_data + 4, &pos);
116  pos++;
117 
118  while (pos + 2 <= ctx->tex_size / 4) {
119  combo_idx = ff_hashtable_get(ctx->combo_ht, ctx->tex_data + pos * 4, &prev_pos) ? pos - prev_pos : 0;
120  idx = combo_idx;
121  PUSH_OP(2);
122  if (pos >= LOOKBACK_WORDS) {
123  old_pos = pos - LOOKBACK_WORDS;
124  if (ff_hashtable_get(ctx->combo_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
125  ff_hashtable_delete(ctx->combo_ht, ctx->tex_data + old_pos * 4);
126  }
127  ff_hashtable_set(ctx->combo_ht, ctx->tex_data + pos * 4, &pos);
128 
129  if (!combo_idx) {
130  idx = ff_hashtable_get(ctx->color_ht, ctx->tex_data + pos * 4, &prev_pos) ? pos - prev_pos : 0;
131  PUSH_OP(2);
132  if (!idx)
133  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + pos * 4));
134  }
135  if (pos >= LOOKBACK_WORDS) {
136  old_pos = pos - LOOKBACK_WORDS;
137  if (ff_hashtable_get(ctx->color_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
138  ff_hashtable_delete(ctx->color_ht, ctx->tex_data + old_pos * 4);
139  }
140  ff_hashtable_set(ctx->color_ht, ctx->tex_data + pos * 4, &pos);
141  pos++;
142 
143  if (!combo_idx) {
144  idx = ff_hashtable_get(ctx->lut_ht, ctx->tex_data + pos * 4, &prev_pos) ? pos - prev_pos : 0;
145  PUSH_OP(2);
146  if (!idx)
147  bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + pos * 4));
148  }
149  if (pos >= LOOKBACK_WORDS) {
150  old_pos = pos - LOOKBACK_WORDS;
151  if (ff_hashtable_get(ctx->lut_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
152  ff_hashtable_delete(ctx->lut_ht, ctx->tex_data + old_pos * 4);
153  }
154  ff_hashtable_set(ctx->lut_ht, ctx->tex_data + pos * 4, &pos);
155  pos++;
156  }
157 
158  return 0;
159 }
160 
161 static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
162  const AVFrame *frame, int *got_packet)
163 {
164  DXVEncContext *ctx = avctx->priv_data;
165  PutByteContext *pbc = &ctx->pbc;
166  int ret;
167 
168  /* unimplemented: needs to depend on compression ratio of tex format */
169  /* under DXT1, we need 3 words to encode load ops for 32 words.
170  * the first 2 words of the texture do not need load ops. */
171  ret = ff_alloc_packet(avctx, pkt, DXV_HEADER_LENGTH + ctx->tex_size + AV_CEIL_RSHIFT(ctx->tex_size - 8, 7) * 12);
172  if (ret < 0)
173  return ret;
174 
175  if (ctx->enc.tex_funct) {
176  uint8_t *safe_data[4] = {frame->data[0], 0, 0, 0};
177  int safe_linesize[4] = {frame->linesize[0], 0, 0, 0};
178 
179  if (avctx->width != DXV_ALIGN(avctx->width) || avctx->height != DXV_ALIGN(avctx->height)) {
181  safe_data,
182  safe_linesize,
183  DXV_ALIGN(avctx->width),
184  DXV_ALIGN(avctx->height),
185  avctx->pix_fmt,
186  1);
187  if (ret < 0)
188  return ret;
189 
191  safe_data,
192  safe_linesize,
193  frame->data,
194  frame->linesize,
195  avctx->pix_fmt,
196  avctx->width,
197  avctx->height);
198 
199  if (avctx->width != DXV_ALIGN(avctx->width)) {
200  for (int y = 0; y < avctx->height; y++) {
201  memset(safe_data[0] + y * safe_linesize[0] + frame->linesize[0], 0, safe_linesize[0] - frame->linesize[0]);
202  }
203  }
204  if (avctx->height != DXV_ALIGN(avctx->height)) {
205  for (int y = avctx->height; y < DXV_ALIGN(avctx->height); y++) {
206  memset(safe_data[0] + y * safe_linesize[0], 0, safe_linesize[0]);
207  }
208  }
209  }
210 
211  ctx->enc.tex_data.out = ctx->tex_data;
212  ctx->enc.frame_data.in = safe_data[0];
213  ctx->enc.stride = safe_linesize[0];
214  ctx->enc.width = DXV_ALIGN(avctx->width);
215  ctx->enc.height = DXV_ALIGN(avctx->height);
217 
218  if (safe_data[0] != frame->data[0])
219  av_freep(&safe_data[0]);
220  } else {
221  /* unimplemented: YCoCg formats */
222  return AVERROR_INVALIDDATA;
223  }
224 
226 
227  bytestream2_put_le32(pbc, ctx->tex_fmt);
228  bytestream2_put_byte(pbc, 4);
229  bytestream2_put_byte(pbc, 0);
230  bytestream2_put_byte(pbc, 0);
231  bytestream2_put_byte(pbc, 0);
232  /* Fill in compressed size later */
233  bytestream2_skip_p(pbc, 4);
234 
235  ret = ctx->compress_tex(avctx);
236  if (ret < 0)
237  return ret;
238 
241 
242  *got_packet = 1;
243  return 0;
244 }
245 
246 static av_cold int dxv_init(AVCodecContext *avctx)
247 {
248  DXVEncContext *ctx = avctx->priv_data;
249  TextureDSPEncContext texdsp;
250  int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
251 
252  if (ret < 0) {
253  av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
254  avctx->width, avctx->height);
255  return ret;
256  }
257 
258  ff_texturedspenc_init(&texdsp);
259 
260  switch (ctx->tex_fmt) {
261  case DXV_FMT_DXT1:
262  ctx->compress_tex = dxv_compress_dxt1;
263  ctx->enc.tex_funct = texdsp.dxt1_block;
264  ctx->enc.tex_ratio = 8;
265  break;
266  default:
267  av_log(avctx, AV_LOG_ERROR, "Invalid format %08X\n", ctx->tex_fmt);
268  return AVERROR_INVALIDDATA;
269  }
270  ctx->enc.raw_ratio = 16;
271  ctx->tex_size = DXV_ALIGN(avctx->width) / TEXTURE_BLOCK_W *
272  DXV_ALIGN(avctx->height) / TEXTURE_BLOCK_H *
273  ctx->enc.tex_ratio;
274  ctx->enc.slice_count = av_clip(avctx->thread_count, 1, DXV_ALIGN(avctx->height) / TEXTURE_BLOCK_H);
275 
276  ctx->tex_data = av_malloc(ctx->tex_size);
277  if (!ctx->tex_data) {
278  return AVERROR(ENOMEM);
279  }
280 
281  ret = ff_hashtable_alloc(&ctx->color_ht, sizeof(uint32_t), sizeof(uint32_t), LOOKBACK_HT_ELEMS);
282  if (ret < 0)
283  return ret;
284  ret = ff_hashtable_alloc(&ctx->lut_ht, sizeof(uint32_t), sizeof(uint32_t), LOOKBACK_HT_ELEMS);
285  if (ret < 0)
286  return ret;
287  ret = ff_hashtable_alloc(&ctx->combo_ht, sizeof(uint64_t), sizeof(uint32_t), LOOKBACK_HT_ELEMS);
288  if (ret < 0)
289  return ret;
290 
291  return 0;
292 }
293 
294 static av_cold int dxv_close(AVCodecContext *avctx)
295 {
296  DXVEncContext *ctx = avctx->priv_data;
297 
298  av_freep(&ctx->tex_data);
299 
300  ff_hashtable_freep(&ctx->color_ht);
301  ff_hashtable_freep(&ctx->lut_ht);
302  ff_hashtable_freep(&ctx->combo_ht);
303 
304  return 0;
305 }
306 
307 #define OFFSET(x) offsetof(DXVEncContext, x)
308 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
309 static const AVOption options[] = {
310  { "format", NULL, OFFSET(tex_fmt), AV_OPT_TYPE_INT, { .i64 = DXV_FMT_DXT1 }, DXV_FMT_DXT1, DXV_FMT_DXT1, FLAGS, .unit = "format" },
311  { "dxt1", "DXT1 (Normal Quality, No Alpha)", 0, AV_OPT_TYPE_CONST, { .i64 = DXV_FMT_DXT1 }, 0, 0, FLAGS, .unit = "format" },
312  { NULL },
313 };
314 
315 static const AVClass dxvenc_class = {
316  .class_name = "DXV encoder",
317  .option = options,
318  .version = LIBAVUTIL_VERSION_INT,
319 };
320 
322  .p.name = "dxv",
323  CODEC_LONG_NAME("Resolume DXV"),
324  .p.type = AVMEDIA_TYPE_VIDEO,
325  .p.id = AV_CODEC_ID_DXV,
326  .init = dxv_init,
328  .close = dxv_close,
329  .priv_data_size = sizeof(DXVEncContext),
330  .p.capabilities = AV_CODEC_CAP_DR1 |
333  .p.priv_class = &dxvenc_class,
335  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
336 };
DXVEncContext::lut_ht
FFHashtableContext * lut_ht
Definition: dxvenc.c:67
CODEC_PIXFMTS
#define CODEC_PIXFMTS(...)
Definition: codec_internal.h:386
DXV_FMT_DXT1
@ DXV_FMT_DXT1
Definition: dxv.h:28
av_clip
#define av_clip
Definition: common.h:100
DXVEncContext
Definition: dxvenc.c:50
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:42
ff_hashtable_delete
int ff_hashtable_delete(struct FFHashtableContext *ctx, const void *key)
Delete a value from a hash table given a key.
Definition: hashtable.c:163
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
state
static struct @508 state
AV_WL32
#define AV_WL32(p, v)
Definition: intreadwrite.h:422
TEXTURE_BLOCK_H
#define TEXTURE_BLOCK_H
Definition: texturedsp.h:43
dxvenc_class
static const AVClass dxvenc_class
Definition: dxvenc.c:315
int64_t
long long int64_t
Definition: coverity.c:34
ff_dxv_encoder
const FFCodec ff_dxv_encoder
Definition: dxvenc.c:321
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:410
AVPacket::data
uint8_t * data
Definition: packet.h:535
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:307
FFCodec
Definition: codec_internal.h:127
ff_hashtable_freep
av_cold void ff_hashtable_freep(FFHashtableContext **ctx)
Free a hash table.
Definition: hashtable.c:206
LOOKBACK_WORDS
#define LOOKBACK_WORDS
Definition: dxvenc.c:48
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:31
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:1561
av_shrink_packet
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
Definition: packet.c:114
DXVEncContext::enc
TextureDSPThreadContext enc
Definition: dxvenc.c:61
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:353
dxv_encode
static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: dxvenc.c:161
TextureDSPThreadContext
Definition: texturedsp.h:69
LOOKBACK_HT_ELEMS
#define LOOKBACK_HT_ELEMS
Definition: dxvenc.c:47
options
static const AVOption options[]
Definition: dxvenc.c:309
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:210
av_cold
#define av_cold
Definition: attributes.h:90
DXVEncContext::tex_data
uint8_t * tex_data
Definition: dxvenc.c:55
FFHashtableContext
Definition: hashtable.c:34
bytestream2_init_writer
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:147
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:98
ctx
AVFormatContext * ctx
Definition: movenc.c:49
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:326
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:95
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
options
Definition: swscale.c:43
DXVEncContext::slice_count
int slice_count
Definition: dxvenc.c:59
dxv_close
static av_cold int dxv_close(AVCodecContext *avctx)
Definition: dxvenc.c:294
PutByteContext
Definition: bytestream.h:37
av_image_alloc
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
Definition: imgutils.c:218
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:536
codec_internal.h
dxv_init
static av_cold int dxv_init(AVCodecContext *avctx)
Definition: dxvenc.c:246
AV_CODEC_ID_DXV
@ AV_CODEC_ID_DXV
Definition: codec_id.h:245
ff_texturedsp_exec_compress_threads
int ff_texturedsp_exec_compress_threads(struct AVCodecContext *avctx, TextureDSPThreadContext *ctx)
ff_hashtable_clear
void ff_hashtable_clear(struct FFHashtableContext *ctx)
Delete all values from a hash table.
Definition: hashtable.c:201
DXVEncContext::tex_size
int64_t tex_size
Definition: dxvenc.c:56
hashtable.h
DXVEncContext::pbc
PutByteContext pbc
Definition: dxvenc.c:53
AV_CODEC_CAP_SLICE_THREADS
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: codec.h:99
ff_hashtable_set
int ff_hashtable_set(struct FFHashtableContext *ctx, const void *key, const void *val)
Store a value in a hash table given a key.
Definition: hashtable.c:119
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
DXV_ALIGN
#define DXV_ALIGN(x)
Definition: dxvenc.c:40
TEXTURE_BLOCK_W
#define TEXTURE_BLOCK_W
Definition: texturedsp.h:42
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AVCodecContext::height
int height
Definition: avcodec.h:592
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:631
FLAGS
#define FLAGS
Definition: dxvenc.c:308
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:81
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
pos
unsigned int pos
Definition: spdifenc.c:414
DXVEncContext::tex_fmt
DXVTextureFormat tex_fmt
Definition: dxvenc.c:63
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
AVCodecContext
main external API structure.
Definition: avcodec.h:431
TextureDSPEncContext::dxt1_block
int(* dxt1_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:64
av_image_copy2
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition: imgutils.h:184
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
DXVEncContext::combo_ht
FFHashtableContext * combo_ht
Definition: dxvenc.c:68
PUSH_OP
#define PUSH_OP(x)
Definition: dxvenc.c:73
DXVEncContext::compress_tex
int(* compress_tex)(AVCodecContext *avctx)
Definition: dxvenc.c:64
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
mem.h
dxv.h
AVPacket
This structure stores compressed data.
Definition: packet.h:512
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
DXVEncContext::color_ht
FFHashtableContext * color_ht
Definition: dxvenc.c:66
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
bytestream.h
ff_hashtable_get
int ff_hashtable_get(const struct FFHashtableContext *ctx, const void *key, void *val)
Look up a value from a hash table given a key.
Definition: hashtable.c:97
imgutils.h
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
ff_hashtable_alloc
av_cold int ff_hashtable_alloc(FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries)
Create a fixed-sized Robin Hood hash table.
Definition: hashtable.c:59