FFmpeg  4.4.5
notchlc.c
Go to the documentation of this file.
1 /*
2  * NotchLC decoder
3  * Copyright (c) 2020 Paul B Mahol
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 <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 
26 #define BITSTREAM_READER_LE
27 #include "libavutil/intreadwrite.h"
28 #include "avcodec.h"
29 #include "bytestream.h"
30 #include "get_bits.h"
31 #include "internal.h"
32 #include "lzf.h"
33 #include "thread.h"
34 
35 typedef struct NotchLCContext {
36  unsigned compressed_size;
37  unsigned format;
38 
41 
44 
45  unsigned texture_size_x;
46  unsigned texture_size_y;
51  unsigned y_data_offset;
52  unsigned uv_data_offset;
53  unsigned y_data_size;
54  unsigned a_data_offset;
55  unsigned uv_count_offset;
56  unsigned a_count_size;
57  unsigned data_end;
58 
62 
64 {
67  avctx->colorspace = AVCOL_SPC_RGB;
70 
71  return 0;
72 }
73 
74 #define HISTORY_SIZE (64 * 1024)
75 
76 static int lz4_decompress(AVCodecContext *avctx,
77  GetByteContext *gb,
78  PutByteContext *pb)
79 {
80  unsigned reference_pos, match_length, delta, pos = 0;
81  uint8_t history[64 * 1024];
82 
83  while (bytestream2_get_bytes_left(gb) > 0) {
84  uint8_t token = bytestream2_get_byte(gb);
85  unsigned num_literals = token >> 4;
86 
87  if (num_literals == 15) {
88  unsigned char current;
89  do {
90  current = bytestream2_get_byte(gb);
91  num_literals += current;
92  } while (current == 255);
93  }
94 
95  if (pos + num_literals < HISTORY_SIZE) {
96  bytestream2_get_buffer(gb, history + pos, num_literals);
97  pos += num_literals;
98  } else {
99  while (num_literals-- > 0) {
100  history[pos++] = bytestream2_get_byte(gb);
101  if (pos == HISTORY_SIZE) {
102  bytestream2_put_buffer(pb, history, HISTORY_SIZE);
103  pos = 0;
104  }
105  }
106  }
107 
108  if (bytestream2_get_bytes_left(gb) <= 0)
109  break;
110 
111  delta = bytestream2_get_le16(gb);
112  if (delta == 0)
113  return 0;
114  match_length = 4 + (token & 0x0F);
115  if (match_length == 4 + 0x0F) {
116  uint8_t current;
117 
118  do {
119  current = bytestream2_get_byte(gb);
120  match_length += current;
121  } while (current == 255);
122  }
123  reference_pos = (pos >= delta) ? (pos - delta) : (HISTORY_SIZE + pos - delta);
124  if (pos + match_length < HISTORY_SIZE && reference_pos + match_length < HISTORY_SIZE) {
125  if (pos >= reference_pos + match_length || reference_pos >= pos + match_length) {
126  memcpy(history + pos, history + reference_pos, match_length);
127  pos += match_length;
128  } else {
129  while (match_length-- > 0)
130  history[pos++] = history[reference_pos++];
131  }
132  } else {
133  while (match_length-- > 0) {
134  history[pos++] = history[reference_pos++];
135  if (pos == HISTORY_SIZE) {
136  bytestream2_put_buffer(pb, history, HISTORY_SIZE);
137  pos = 0;
138  }
139  reference_pos %= HISTORY_SIZE;
140  }
141  }
142  }
143 
144  bytestream2_put_buffer(pb, history, pos);
145 
146  return bytestream2_tell_p(pb);
147 }
148 
150  unsigned uncompressed_size)
151 {
152  NotchLCContext *s = avctx->priv_data;
153  GetByteContext rgb, dgb, *gb = &s->gb;
155  int ylinesize, ulinesize, vlinesize, alinesize;
156  uint16_t *dsty, *dstu, *dstv, *dsta;
157  int ret;
158 
159  s->texture_size_x = bytestream2_get_le32(gb);
160  s->texture_size_y = bytestream2_get_le32(gb);
161 
162  ret = ff_set_dimensions(avctx, s->texture_size_x, s->texture_size_y);
163  if (ret < 0)
164  return ret;
165 
166  s->uv_offset_data_offset = bytestream2_get_le32(gb);
167  if (s->uv_offset_data_offset >= UINT_MAX / 4)
168  return AVERROR_INVALIDDATA;
169  s->uv_offset_data_offset *= 4;
170  if (s->uv_offset_data_offset >= uncompressed_size)
171  return AVERROR_INVALIDDATA;
172 
173  s->y_control_data_offset = bytestream2_get_le32(gb);
174  if (s->y_control_data_offset >= UINT_MAX / 4)
175  return AVERROR_INVALIDDATA;
176  s->y_control_data_offset *= 4;
177  if (s->y_control_data_offset >= uncompressed_size)
178  return AVERROR_INVALIDDATA;
179 
180  s->a_control_word_offset = bytestream2_get_le32(gb);
181  if (s->a_control_word_offset >= UINT_MAX / 4)
182  return AVERROR_INVALIDDATA;
183  s->a_control_word_offset *= 4;
184  if (s->a_control_word_offset >= uncompressed_size)
185  return AVERROR_INVALIDDATA;
186 
187  s->uv_data_offset = bytestream2_get_le32(gb);
188  if (s->uv_data_offset >= UINT_MAX / 4)
189  return AVERROR_INVALIDDATA;
190  s->uv_data_offset *= 4;
191  if (s->uv_data_offset >= uncompressed_size)
192  return AVERROR_INVALIDDATA;
193 
194  s->y_data_size = bytestream2_get_le32(gb);
195  if (s->y_data_size >= UINT_MAX / 4)
196  return AVERROR_INVALIDDATA;
197 
198  s->a_data_offset = bytestream2_get_le32(gb);
199  if (s->a_data_offset >= UINT_MAX / 4)
200  return AVERROR_INVALIDDATA;
201  s->a_data_offset *= 4;
202  if (s->a_data_offset >= uncompressed_size)
203  return AVERROR_INVALIDDATA;
204 
205  s->a_count_size = bytestream2_get_le32(gb);
206  if (s->a_count_size >= UINT_MAX / 4)
207  return AVERROR_INVALIDDATA;
208  s->a_count_size *= 4;
209  if (s->a_count_size >= uncompressed_size)
210  return AVERROR_INVALIDDATA;
211 
212  s->data_end = bytestream2_get_le32(gb);
213  if (s->data_end > uncompressed_size)
214  return AVERROR_INVALIDDATA;
215 
216  s->y_data_row_offsets = bytestream2_tell(gb);
217  if (s->data_end <= s->y_data_size)
218  return AVERROR_INVALIDDATA;
219  s->y_data_offset = s->data_end - s->y_data_size;
220  if (s->y_data_offset <= s->a_data_offset)
221  return AVERROR_INVALIDDATA;
222  s->uv_count_offset = s->y_data_offset - s->a_data_offset;
223 
224  if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
225  return ret;
226 
227  rgb = *gb;
228  dgb = *gb;
229  bytestream2_seek(&rgb, s->y_data_row_offsets, SEEK_SET);
230  bytestream2_seek(gb, s->y_control_data_offset, SEEK_SET);
231 
232  if (bytestream2_get_bytes_left(gb) < (avctx->height + 3) / 4 * ((avctx->width + 3) / 4) * 4)
233  return AVERROR_INVALIDDATA;
234 
235  dsty = (uint16_t *)p->data[0];
236  dsta = (uint16_t *)p->data[3];
237  ylinesize = p->linesize[0] / 2;
238  alinesize = p->linesize[3] / 2;
239 
240  for (int y = 0; y < avctx->height; y += 4) {
241  const unsigned row_offset = bytestream2_get_le32(&rgb);
242 
243  bytestream2_seek(&dgb, s->y_data_offset + row_offset, SEEK_SET);
244 
246  if (ret < 0)
247  return ret;
248  for (int x = 0; x < avctx->width; x += 4) {
249  unsigned item = bytestream2_get_le32(gb);
250  unsigned y_min = item & 4095;
251  unsigned y_max = (item >> 12) & 4095;
252  unsigned y_diff = y_max - y_min;
253  unsigned control[4];
254 
255  control[0] = (item >> 24) & 3;
256  control[1] = (item >> 26) & 3;
257  control[2] = (item >> 28) & 3;
258  control[3] = (item >> 30) & 3;
259 
260  for (int i = 0; i < 4; i++) {
261  const int nb_bits = control[i] + 1;
262  const int div = (1 << nb_bits) - 1;
263  const int add = div - 1;
264 
265  dsty[x + i * ylinesize + 0] = av_clip_uintp2(y_min + ((y_diff * get_bits(&bit, nb_bits) + add) / div), 12);
266  dsty[x + i * ylinesize + 1] = av_clip_uintp2(y_min + ((y_diff * get_bits(&bit, nb_bits) + add) / div), 12);
267  dsty[x + i * ylinesize + 2] = av_clip_uintp2(y_min + ((y_diff * get_bits(&bit, nb_bits) + add) / div), 12);
268  dsty[x + i * ylinesize + 3] = av_clip_uintp2(y_min + ((y_diff * get_bits(&bit, nb_bits) + add) / div), 12);
269  }
270  }
271 
272  dsty += 4 * ylinesize;
273  }
274 
275  rgb = *gb;
276  dgb = *gb;
277  bytestream2_seek(gb, s->a_control_word_offset, SEEK_SET);
278  if (s->uv_count_offset == s->a_control_word_offset) {
279  for (int y = 0; y < avctx->height; y++) {
280  for (int x = 0; x < avctx->width; x++)
281  dsta[x] = 4095;
282  dsta += alinesize;
283  }
284  } else {
285  if (bytestream2_get_bytes_left(gb) < (avctx->height + 15) / 16 * ((avctx->width + 15) / 16) * 8)
286  return AVERROR_INVALIDDATA;
287 
288  for (int y = 0; y < avctx->height; y += 16) {
289  for (int x = 0; x < avctx->width; x += 16) {
290  unsigned m = bytestream2_get_le32(gb);
291  unsigned offset = bytestream2_get_le32(gb);
292  unsigned alpha0, alpha1;
293  uint64_t control;
294 
295  if (offset >= UINT_MAX / 4)
296  return AVERROR_INVALIDDATA;
297  offset = offset * 4 + s->uv_data_offset + s->a_data_offset;
298  if (offset >= s->data_end)
299  return AVERROR_INVALIDDATA;
300 
301  bytestream2_seek(&dgb, offset, SEEK_SET);
302  control = bytestream2_get_le64(&dgb);
303  alpha0 = control & 0xFF;
304  alpha1 = (control >> 8) & 0xFF;
305  control = control >> 16;
306 
307  for (int by = 0; by < 4; by++) {
308  for (int bx = 0; bx < 4; bx++) {
309  switch (m & 3) {
310  case 0:
311  for (int i = 0; i < 4; i++) {
312  for (int j = 0; j < 4; j++) {
313  dsta[x + (i + by * 4) * alinesize + bx * 4 + j] = 0;
314  }
315  }
316  break;
317  case 1:
318  for (int i = 0; i < 4; i++) {
319  for (int j = 0; j < 4; j++) {
320  dsta[x + (i + by * 4) * alinesize + bx * 4 + j] = 4095;
321  }
322  }
323  break;
324  case 2:
325  for (int i = 0; i < 4; i++) {
326  for (int j = 0; j < 4; j++) {
327  dsta[x + (i + by * 4) * alinesize + bx * 4 + j] = (alpha0 + (alpha1 - alpha0) * (control & 7)) << 4;
328  }
329  }
330  break;
331  default:
332  return AVERROR_INVALIDDATA;
333  }
334 
335  control >>= 3;
336  m >>= 2;
337  }
338  }
339  }
340 
341  dsta += 16 * alinesize;
342  }
343  }
344 
345  bytestream2_seek(&rgb, s->uv_offset_data_offset, SEEK_SET);
346 
347  dstu = (uint16_t *)p->data[1];
348  dstv = (uint16_t *)p->data[2];
349  ulinesize = p->linesize[1] / 2;
350  vlinesize = p->linesize[2] / 2;
351 
352  for (int y = 0; y < avctx->height; y += 16) {
353  for (int x = 0; x < avctx->width; x += 16) {
354  unsigned offset = bytestream2_get_le32(&rgb) * 4;
355  int u[16][16] = { 0 }, v[16][16] = { 0 };
356  int u0, v0, u1, v1, udif, vdif;
357  unsigned escape, is8x8, loc;
358 
359  bytestream2_seek(&dgb, s->uv_data_offset + offset, SEEK_SET);
360 
361  is8x8 = bytestream2_get_le16(&dgb);
362  escape = bytestream2_get_le16(&dgb);
363 
364  if (escape == 0 && is8x8 == 0) {
365  u0 = bytestream2_get_byte(&dgb);
366  v0 = bytestream2_get_byte(&dgb);
367  u1 = bytestream2_get_byte(&dgb);
368  v1 = bytestream2_get_byte(&dgb);
369  loc = bytestream2_get_le32(&dgb);
370  u0 = (u0 << 4) | (u0 & 0xF);
371  v0 = (v0 << 4) | (v0 & 0xF);
372  u1 = (u1 << 4) | (u1 & 0xF);
373  v1 = (v1 << 4) | (v1 & 0xF);
374  udif = u1 - u0;
375  vdif = v1 - v0;
376 
377  for (int i = 0; i < 16; i += 4) {
378  for (int j = 0; j < 16; j += 4) {
379  for (int ii = 0; ii < 4; ii++) {
380  for (int jj = 0; jj < 4; jj++) {
381  u[i + ii][j + jj] = u0 + ((udif * (int)(loc & 3) + 2) / 3);
382  v[i + ii][j + jj] = v0 + ((vdif * (int)(loc & 3) + 2) / 3);
383  }
384  }
385 
386  loc >>= 2;
387  }
388  }
389  } else {
390  for (int i = 0; i < 16; i += 8) {
391  for (int j = 0; j < 16; j += 8) {
392  if (is8x8 & 1) {
393  u0 = bytestream2_get_byte(&dgb);
394  v0 = bytestream2_get_byte(&dgb);
395  u1 = bytestream2_get_byte(&dgb);
396  v1 = bytestream2_get_byte(&dgb);
397  loc = bytestream2_get_le32(&dgb);
398  u0 = (u0 << 4) | (u0 & 0xF);
399  v0 = (v0 << 4) | (v0 & 0xF);
400  u1 = (u1 << 4) | (u1 & 0xF);
401  v1 = (v1 << 4) | (v1 & 0xF);
402  udif = u1 - u0;
403  vdif = v1 - v0;
404 
405  for (int ii = 0; ii < 8; ii += 2) {
406  for (int jj = 0; jj < 8; jj += 2) {
407  for (int iii = 0; iii < 2; iii++) {
408  for (int jjj = 0; jjj < 2; jjj++) {
409  u[i + ii + iii][j + jj + jjj] = u0 + ((udif * (int)(loc & 3) + 2) / 3);
410  v[i + ii + iii][j + jj + jjj] = v0 + ((vdif * (int)(loc & 3) + 2) / 3);
411  }
412  }
413 
414  loc >>= 2;
415  }
416  }
417  } else if (escape) {
418  for (int ii = 0; ii < 8; ii += 4) {
419  for (int jj = 0; jj < 8; jj += 4) {
420  u0 = bytestream2_get_byte(&dgb);
421  v0 = bytestream2_get_byte(&dgb);
422  u1 = bytestream2_get_byte(&dgb);
423  v1 = bytestream2_get_byte(&dgb);
424  loc = bytestream2_get_le32(&dgb);
425  u0 = (u0 << 4) | (u0 & 0xF);
426  v0 = (v0 << 4) | (v0 & 0xF);
427  u1 = (u1 << 4) | (u1 & 0xF);
428  v1 = (v1 << 4) | (v1 & 0xF);
429  udif = u1 - u0;
430  vdif = v1 - v0;
431 
432  for (int iii = 0; iii < 4; iii++) {
433  for (int jjj = 0; jjj < 4; jjj++) {
434  u[i + ii + iii][j + jj + jjj] = u0 + ((udif * (int)(loc & 3) + 2) / 3);
435  v[i + ii + iii][j + jj + jjj] = v0 + ((vdif * (int)(loc & 3) + 2) / 3);
436 
437  loc >>= 2;
438  }
439  }
440  }
441  }
442  }
443 
444  is8x8 >>= 1;
445  }
446  }
447  }
448 
449  for (int i = 0; i < 16; i++) {
450  for (int j = 0; j < 16; j++) {
451  dstu[x + i * ulinesize + j] = u[i][j];
452  dstv[x + i * vlinesize + j] = v[i][j];
453  }
454  }
455  }
456 
457  dstu += 16 * ulinesize;
458  dstv += 16 * vlinesize;
459  }
460 
461  return 0;
462 }
463 
464 static int decode_frame(AVCodecContext *avctx,
465  void *data, int *got_frame,
466  AVPacket *avpkt)
467 {
468  NotchLCContext *s = avctx->priv_data;
469  ThreadFrame frame = { .f = data };
470  GetByteContext *gb = &s->gb;
471  PutByteContext *pb = &s->pb;
472  unsigned uncompressed_size;
473  AVFrame *p = data;
474  int ret;
475 
476  if (avpkt->size <= 40)
477  return AVERROR_INVALIDDATA;
478 
479  bytestream2_init(gb, avpkt->data, avpkt->size);
480 
481  if (bytestream2_get_le32(gb) != MKBETAG('N','L','C','1'))
482  return AVERROR_INVALIDDATA;
483 
484  uncompressed_size = bytestream2_get_le32(gb);
485  s->compressed_size = bytestream2_get_le32(gb);
486  s->format = bytestream2_get_le32(gb);
487 
488  if (s->format > 2)
489  return AVERROR_PATCHWELCOME;
490 
491  if (s->format == 0) {
492  ret = ff_lzf_uncompress(gb, &s->lzf_buffer, &s->lzf_size);
493  if (ret < 0)
494  return ret;
495 
496  if (uncompressed_size > s->lzf_size)
497  return AVERROR_INVALIDDATA;
498 
499  bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
500  } else if (s->format == 1) {
501  if (bytestream2_get_bytes_left(gb) < uncompressed_size / 255)
502  return AVERROR_INVALIDDATA;
503 
504  av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size,
505  uncompressed_size);
506  if (!s->uncompressed_buffer)
507  return AVERROR(ENOMEM);
508 
509  bytestream2_init_writer(pb, s->uncompressed_buffer, s->uncompressed_size);
510 
511  ret = lz4_decompress(avctx, gb, pb);
512  if (ret != uncompressed_size)
513  return AVERROR_INVALIDDATA;
514 
515  bytestream2_init(gb, s->uncompressed_buffer, uncompressed_size);
516  }
517 
518  ret = decode_blocks(avctx, p, &frame, uncompressed_size);
519  if (ret < 0)
520  return ret;
521 
523  p->key_frame = 1;
524 
525  *got_frame = 1;
526 
527  return avpkt->size;
528 }
529 
531 {
532  NotchLCContext *s = avctx->priv_data;
533 
534  av_freep(&s->uncompressed_buffer);
535  s->uncompressed_size = 0;
536  av_freep(&s->lzf_buffer);
537  s->lzf_size = 0;
538 
539  return 0;
540 }
541 
543  .name = "notchlc",
544  .long_name = NULL_IF_CONFIG_SMALL("NotchLC"),
545  .type = AVMEDIA_TYPE_VIDEO,
546  .id = AV_CODEC_ID_NOTCHLC,
547  .priv_data_size = sizeof(NotchLCContext),
548  .init = decode_init,
549  .close = decode_end,
550  .decode = decode_frame,
552 };
#define av_cold
Definition: attributes.h:88
uint8_t
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:267
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:147
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
Definition: bytestream.h:197
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:212
static av_always_inline int bytestream2_tell(GetByteContext *g)
Definition: bytestream.h:192
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
Definition: bytestream.h:286
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:264
#define bit(string, value)
Definition: cbs_mpeg2.c:58
#define s(width, name)
Definition: cbs_vp9.c:257
#define MKBETAG(a, b, c, d)
Definition: common.h:479
#define av_clip_uintp2
Definition: common.h:146
long long int64_t
Definition: coverity.c:34
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
static AVFrame * frame
static float add(float src0, float src1)
int
bitstream reader API header.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:108
@ AV_CODEC_ID_NOTCHLC
Definition: codec_id.h:301
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:50
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AVERROR(e)
Definition: error.h:43
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
int i
Definition: input.c:407
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:84
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size)
Definition: lzf.c:40
const char data[16]
Definition: mxf.c:142
#define HISTORY_SIZE
Definition: notchlc.c:74
AVCodec ff_notchlc_decoder
Definition: notchlc.c:542
static int decode_blocks(AVCodecContext *avctx, AVFrame *p, ThreadFrame *frame, unsigned uncompressed_size)
Definition: notchlc.c:149
static av_cold int decode_init(AVCodecContext *avctx)
Definition: notchlc.c:63
static av_cold int decode_end(AVCodecContext *avctx)
Definition: notchlc.c:530
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: notchlc.c:464
static int lz4_decompress(AVCodecContext *avctx, GetByteContext *gb, PutByteContext *pb)
Definition: notchlc.c:76
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:586
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:460
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:497
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:440
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
Definition: pixfmt.h:513
FF_ENABLE_DEPRECATION_WARNINGS int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
#define v0
Definition: regdef.h:26
static const SheerTable rgb[2]
unsigned int pos
Definition: spdifenc.c:412
main external API structure.
Definition: avcodec.h:536
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:746
int width
picture width / height.
Definition: avcodec.h:709
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:1171
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:1150
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:1164
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:1157
void * priv_data
Definition: avcodec.h:563
AVCodec.
Definition: codec.h:197
const char * name
Name of the codec implementation.
Definition: codec.h:204
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:332
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:396
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:349
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:401
This structure stores compressed data.
Definition: packet.h:346
int size
Definition: packet.h:370
uint8_t * data
Definition: packet.h:369
const uint8_t * buffer
Definition: bytestream.h:34
uint8_t * uncompressed_buffer
Definition: notchlc.c:39
unsigned y_data_offset
Definition: notchlc.c:51
unsigned uncompressed_size
Definition: notchlc.c:40
unsigned a_count_size
Definition: notchlc.c:56
unsigned format
Definition: notchlc.c:37
unsigned texture_size_x
Definition: notchlc.c:45
unsigned y_control_data_offset
Definition: notchlc.c:49
unsigned uv_count_offset
Definition: notchlc.c:55
uint8_t * lzf_buffer
Definition: notchlc.c:42
PutByteContext pb
Definition: notchlc.c:60
unsigned uv_data_offset
Definition: notchlc.c:52
int64_t lzf_size
Definition: notchlc.c:43
GetByteContext gb
Definition: notchlc.c:59
unsigned uv_offset_data_offset
Definition: notchlc.c:48
unsigned texture_size_y
Definition: notchlc.c:46
unsigned a_data_offset
Definition: notchlc.c:54
unsigned y_data_row_offsets
Definition: notchlc.c:47
unsigned a_control_word_offset
Definition: notchlc.c:50
unsigned data_end
Definition: notchlc.c:57
unsigned y_data_size
Definition: notchlc.c:53
unsigned compressed_size
Definition: notchlc.c:36
Definition: rpzaenc.c:58
#define av_freep(p)
static const uint8_t offset[127][2]
Definition: vf_spp.c:107
float delta