FFmpeg
cri.c
Go to the documentation of this file.
1 /*
2  * CRI image decoder
3  *
4  * Copyright (c) 2020 Paul B Mahol
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Cintel RAW image decoder
26  */
27 
28 #define BITSTREAM_READER_LE
29 
31 #include "libavutil/intfloat.h"
32 #include "libavutil/display.h"
33 #include "avcodec.h"
34 #include "bytestream.h"
35 #include "codec_internal.h"
36 #include "decode.h"
37 #include "get_bits.h"
38 #include "thread.h"
39 
40 typedef struct CRIContext {
41  AVCodecContext *jpeg_avctx; // wrapper context for MJPEG
42  AVPacket *jpkt; // encoded JPEG tile
43  AVFrame *jpgframe; // decoded JPEG tile
44 
47  const uint8_t *data;
48  unsigned data_size;
49  uint64_t tile_size[4];
50 } CRIContext;
51 
53 {
54  CRIContext *s = avctx->priv_data;
55  int ret;
56 
57  s->jpgframe = av_frame_alloc();
58  if (!s->jpgframe)
59  return AVERROR(ENOMEM);
60 
61  s->jpkt = av_packet_alloc();
62  if (!s->jpkt)
63  return AVERROR(ENOMEM);
64 
67  if (!s->jpeg_avctx)
68  return AVERROR(ENOMEM);
69  s->jpeg_avctx->flags = avctx->flags;
70  s->jpeg_avctx->flags2 = avctx->flags2;
71  s->jpeg_avctx->idct_algo = avctx->idct_algo;
72  ret = avcodec_open2(s->jpeg_avctx, NULL, NULL);
73  if (ret < 0)
74  return ret;
75 
76  return 0;
77 }
78 
79 static void unpack_10bit(GetByteContext *gb, uint16_t *dst, int shift,
80  int w, int h, ptrdiff_t stride)
81 {
82  int count = w * h;
83  int pos = 0;
84 
85  while (count > 0) {
86  uint32_t a0, a1, a2, a3;
87  if (bytestream2_get_bytes_left(gb) < 4)
88  break;
89  a0 = bytestream2_get_le32(gb);
90  a1 = bytestream2_get_le32(gb);
91  a2 = bytestream2_get_le32(gb);
92  a3 = bytestream2_get_le32(gb);
93  dst[pos] = (((a0 >> 1) & 0xE00) | (a0 & 0x1FF)) << shift;
94  pos++;
95  if (pos >= w) {
96  if (count == 1)
97  break;
98  dst += stride;
99  pos = 0;
100  }
101  dst[pos] = (((a0 >> 13) & 0x3F) | ((a0 >> 14) & 0xFC0)) << shift;
102  pos++;
103  if (pos >= w) {
104  if (count == 2)
105  break;
106  dst += stride;
107  pos = 0;
108  }
109  dst[pos] = (((a0 >> 26) & 7) | ((a1 & 0x1FF) << 3)) << shift;
110  pos++;
111  if (pos >= w) {
112  if (count == 3)
113  break;
114  dst += stride;
115  pos = 0;
116  }
117  dst[pos] = (((a1 >> 10) & 0x1FF) | ((a1 >> 11) & 0xE00)) << shift;
118  pos++;
119  if (pos >= w) {
120  if (count == 4)
121  break;
122  dst += stride;
123  pos = 0;
124  }
125  dst[pos] = (((a1 >> 23) & 0x3F) | ((a2 & 0x3F) << 6)) << shift;
126  pos++;
127  if (pos >= w) {
128  if (count == 5)
129  break;
130  dst += stride;
131  pos = 0;
132  }
133  dst[pos] = (((a2 >> 7) & 0xFF8) | ((a2 >> 6) & 7)) << shift;
134  pos++;
135  if (pos >= w) {
136  if (count == 6)
137  break;
138  dst += stride;
139  pos = 0;
140  }
141  dst[pos] = (((a3 & 7) << 9) | ((a2 >> 20) & 0x1FF)) << shift;
142  pos++;
143  if (pos >= w) {
144  if (count == 7)
145  break;
146  dst += stride;
147  pos = 0;
148  }
149  dst[pos] = (((a3 >> 4) & 0xFC0) | ((a3 >> 3) & 0x3F)) << shift;
150  pos++;
151  if (pos >= w) {
152  if (count == 8)
153  break;
154  dst += stride;
155  pos = 0;
156  }
157  dst[pos] = (((a3 >> 16) & 7) | ((a3 >> 17) & 0xFF8)) << shift;
158  pos++;
159  if (pos >= w) {
160  if (count == 9)
161  break;
162  dst += stride;
163  pos = 0;
164  }
165 
166  count -= 9;
167  }
168 }
169 
171  int *got_frame, AVPacket *avpkt)
172 {
173  CRIContext *s = avctx->priv_data;
174  GetByteContext *gb = &s->gb;
175  int ret, bps, hflip = 0, vflip = 0;
176  AVFrameSideData *rotation;
177  int compressed = 0;
178 
179  s->data = NULL;
180  s->data_size = 0;
181 
182  bytestream2_init(gb, avpkt->data, avpkt->size);
183 
184  while (bytestream2_get_bytes_left(gb) > 8) {
185  char codec_name[1024];
186  uint32_t key, length;
187  float framerate;
188  int width, height;
189 
190  key = bytestream2_get_le32(gb);
191  length = bytestream2_get_le32(gb);
192 
193  switch (key) {
194  case 1:
195  if (length != 4)
196  return AVERROR_INVALIDDATA;
197 
198  if (bytestream2_get_le32(gb) != MKTAG('D', 'V', 'C', 'C'))
199  return AVERROR_INVALIDDATA;
200  break;
201  case 100:
202  if (length < 16)
203  return AVERROR_INVALIDDATA;
204  width = bytestream2_get_le32(gb);
205  height = bytestream2_get_le32(gb);
206  s->color_model = bytestream2_get_le32(gb);
207  if (bytestream2_get_le32(gb) != 1)
208  return AVERROR_INVALIDDATA;
209  ret = ff_set_dimensions(avctx, width, height);
210  if (ret < 0)
211  return ret;
212  length -= 16;
213  goto skip;
214  case 101:
215  if (length != 4)
216  return AVERROR_INVALIDDATA;
217 
218  if (bytestream2_get_le32(gb) != 0)
219  return AVERROR_INVALIDDATA;
220  break;
221  case 102:
222  bytestream2_get_buffer(gb, codec_name, FFMIN(length, sizeof(codec_name) - 1));
223  length -= FFMIN(length, sizeof(codec_name) - 1);
224  if (strncmp(codec_name, "cintel_craw", FFMIN(length, sizeof(codec_name) - 1)))
225  return AVERROR_INVALIDDATA;
226  compressed = 1;
227  goto skip;
228  case 103:
229  if (bytestream2_get_bytes_left(gb) < length)
230  return AVERROR_INVALIDDATA;
231  s->data = gb->buffer;
232  s->data_size = length;
233  goto skip;
234  case 105:
235  if (length <= 0)
236  return AVERROR_INVALIDDATA;
237  hflip = bytestream2_get_byte(gb) != 0;
238  length--;
239  goto skip;
240  case 106:
241  if (length <= 0)
242  return AVERROR_INVALIDDATA;
243  vflip = bytestream2_get_byte(gb) != 0;
244  length--;
245  goto skip;
246  case 107:
247  if (length != 4)
248  return AVERROR_INVALIDDATA;
249  framerate = av_int2float(bytestream2_get_le32(gb));
250  avctx->framerate.num = framerate * 1000;
251  avctx->framerate.den = 1000;
252  break;
253  case 119:
254  if (length != 32)
255  return AVERROR_INVALIDDATA;
256 
257  for (int i = 0; i < 4; i++)
258  s->tile_size[i] = bytestream2_get_le64(gb);
259  break;
260  default:
261  av_log(avctx, AV_LOG_DEBUG, "skipping unknown key %u of length %u\n", key, length);
262 skip:
263  bytestream2_skip(gb, length);
264  }
265  }
266 
267  switch (s->color_model) {
268  case 76:
269  case 88:
271  break;
272  case 77:
273  case 89:
275  break;
276  case 78:
277  case 90:
279  break;
280  case 45:
281  case 79:
282  case 91:
284  break;
285  }
286 
287  switch (s->color_model) {
288  case 45:
289  bps = 10;
290  break;
291  case 76:
292  case 77:
293  case 78:
294  case 79:
295  bps = 12;
296  break;
297  case 88:
298  case 89:
299  case 90:
300  case 91:
301  bps = 16;
302  break;
303  default:
304  return AVERROR_INVALIDDATA;
305  }
306 
307  if (compressed) {
308  for (int i = 0; i < 4; i++) {
309  if (s->tile_size[i] >= s->data_size)
310  return AVERROR_INVALIDDATA;
311  }
312 
313  if (s->tile_size[0] + s->tile_size[1] + s->tile_size[2] + s->tile_size[3] !=
314  s->data_size)
315  return AVERROR_INVALIDDATA;
316  }
317 
318  if (!s->data || !s->data_size)
319  return AVERROR_INVALIDDATA;
320 
321  if (avctx->skip_frame >= AVDISCARD_ALL)
322  return avpkt->size;
323 
324  if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
325  return ret;
326 
327  avctx->bits_per_raw_sample = bps;
328 
329  if (!compressed && s->color_model == 45) {
330  uint16_t *dst = (uint16_t *)p->data[0];
331  GetByteContext gb;
332 
333  bytestream2_init(&gb, s->data, s->data_size);
334  unpack_10bit(&gb, dst, 4, avctx->width, avctx->height, p->linesize[0] / 2);
335  } else if (!compressed) {
336  GetBitContext gbit;
337  const int shift = 16 - bps;
338 
339  ret = init_get_bits8(&gbit, s->data, s->data_size);
340  if (ret < 0)
341  return ret;
342 
343  for (int y = 0; y < avctx->height; y++) {
344  uint16_t *dst = (uint16_t *)(p->data[0] + y * p->linesize[0]);
345 
346  if (get_bits_left(&gbit) < avctx->width * bps)
347  break;
348 
349  for (int x = 0; x < avctx->width; x++)
350  dst[x] = get_bits(&gbit, bps) << shift;
351  }
352  } else {
353  unsigned offset = 0;
354 
355  for (int tile = 0; tile < 4; tile++) {
356  av_packet_unref(s->jpkt);
357  s->jpkt->data = (uint8_t *)s->data + offset;
358  s->jpkt->size = s->tile_size[tile];
359 
360  ret = avcodec_send_packet(s->jpeg_avctx, s->jpkt);
361  if (ret < 0) {
362  av_log(avctx, AV_LOG_ERROR, "Error submitting a packet for decoding\n");
363  return ret;
364  }
365 
366  ret = avcodec_receive_frame(s->jpeg_avctx, s->jpgframe);
367  if (ret < 0 || s->jpgframe->format != AV_PIX_FMT_GRAY16 ||
368  s->jpeg_avctx->width * 2 != avctx->width ||
369  s->jpeg_avctx->height * 2 != avctx->height) {
370  if (ret < 0) {
371  av_log(avctx, AV_LOG_ERROR,
372  "JPEG decoding error (%d).\n", ret);
373  } else {
374  av_log(avctx, AV_LOG_ERROR,
375  "JPEG invalid format.\n");
377  }
378 
379  /* Normally skip, if error explode */
380  if (avctx->err_recognition & AV_EF_EXPLODE)
381  return ret;
382  else
383  return 0;
384  }
385 
386  for (int y = 0; y < s->jpeg_avctx->height; y++) {
387  const int hw = s->jpgframe->width / 2;
388  uint16_t *dst = (uint16_t *)(p->data[0] + (y * 2) * p->linesize[0] + tile * hw * 2);
389  const uint16_t *src = (const uint16_t *)(s->jpgframe->data[0] + y * s->jpgframe->linesize[0]);
390 
391  memcpy(dst, src, hw * 2);
392  src += hw;
393  dst += p->linesize[0] / 2;
394  memcpy(dst, src, hw * 2);
395  }
396 
397  av_frame_unref(s->jpgframe);
398  offset += s->tile_size[tile];
399  }
400  }
401 
402  if (hflip || vflip) {
404  sizeof(int32_t) * 9, &rotation);
405  if (rotation) {
406  av_display_rotation_set((int32_t *)rotation->data, 0.f);
407  av_display_matrix_flip((int32_t *)rotation->data, hflip, vflip);
408  }
409  }
410 
411  *got_frame = 1;
412 
413  return 0;
414 }
415 
417 {
418  CRIContext *s = avctx->priv_data;
419 
420  av_frame_free(&s->jpgframe);
421  av_packet_free(&s->jpkt);
422  avcodec_free_context(&s->jpeg_avctx);
423 
424  return 0;
425 }
426 
428  .p.name = "cri",
429  .p.type = AVMEDIA_TYPE_VIDEO,
430  .p.id = AV_CODEC_ID_CRI,
431  .priv_data_size = sizeof(CRIContext),
434  .close = cri_decode_close,
435  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
436  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
438  CODEC_LONG_NAME("Cintel RAW"),
439 };
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:430
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: defs.h:51
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
CRIContext::data
const uint8_t * data
Definition: cri.c:47
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:678
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
GetByteContext
Definition: bytestream.h:33
CRIContext
Definition: cri.c:40
unpack_10bit
static void unpack_10bit(GetByteContext *gb, uint16_t *dst, int shift, int w, int h, ptrdiff_t stride)
Definition: cri.c:79
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1398
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:63
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:410
w
uint8_t w
Definition: llviddspenc.c:38
ff_mjpeg_decoder
const FFCodec ff_mjpeg_decoder
av_display_matrix_flip
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
Definition: display.c:66
AVPacket::data
uint8_t * data
Definition: packet.h:535
FFCodec
Definition: codec_internal.h:127
av_display_rotation_set
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure clockwise rotation by the specified angle (in de...
Definition: display.c:51
AV_FRAME_DATA_DISPLAYMATRIX
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:85
CRIContext::jpkt
AVPacket * jpkt
Definition: cri.c:42
intfloat.h
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:91
AV_PIX_FMT_BAYER_GRBG16
#define AV_PIX_FMT_BAYER_GRBG16
Definition: pixfmt.h:557
thread.h
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: packet.c:75
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:431
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:551
bytestream2_skip
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:168
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:318
ff_cri_decoder
const FFCodec ff_cri_decoder
Definition: cri.c:427
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::skip_frame
enum AVDiscard skip_frame
Skip decoding for selected frames.
Definition: avcodec.h:1662
av_int2float
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
GetBitContext
Definition: get_bits.h:108
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:488
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:511
a2
static double a2(void *priv, double x, double y)
Definition: vf_xfade.c:2030
AVRational::num
int num
Numerator.
Definition: rational.h:59
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:51
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
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:528
avcodec_alloc_context3
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:149
attributes_internal.h
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:341
s
#define s(width, name)
Definition: cbs_vp9.c:198
ff_thread_get_buffer
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: pthread_frame.c:1048
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
CRIContext::tile_size
uint64_t tile_size[4]
Definition: cri.c:49
avcodec_receive_frame
int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder or encoder (when the AV_CODEC_FLAG_RECON_FRAME flag is used...
Definition: avcodec.c:702
cri_decode_init
static av_cold int cri_decode_init(AVCodecContext *avctx)
Definition: cri.c:52
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1553
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
decode.h
get_bits.h
key
const char * key
Definition: hwcontext_opencl.c:189
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:326
EXTERN
#define EXTERN
Definition: attributes_internal.h:34
AV_PIX_FMT_BAYER_BGGR16
#define AV_PIX_FMT_BAYER_BGGR16
Definition: pixfmt.h:554
CRIContext::jpeg_avctx
AVCodecContext * jpeg_avctx
Definition: cri.c:41
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:95
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:221
framerate
float framerate
Definition: av1_levels.c:29
NULL
#define NULL
Definition: coverity.c:32
a3
static double a3(void *priv, double x, double y)
Definition: vf_xfade.c:2031
avcodec_free_context
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Definition: options.c:164
CRIContext::jpgframe
AVFrame * jpgframe
Definition: cri.c:43
AV_PIX_FMT_BAYER_GBRG16
#define AV_PIX_FMT_BAYER_GBRG16
Definition: pixfmt.h:556
bytestream2_get_buffer
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:267
avcodec_open2
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition: avcodec.c:143
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
AVCodecContext::flags2
int flags2
AV_CODEC_FLAG2_*.
Definition: avcodec.h:495
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
height
#define height
Definition: dsp.h:85
codec_internal.h
shift
static int shift(int a, int b)
Definition: bonk.c:261
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
bps
unsigned bps
Definition: movenc.c:1912
ff_frame_new_side_data
int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame, enum AVFrameSideDataType type, size_t size, AVFrameSideData **psd)
Wrapper around av_frame_new_side_data, which rejects side data overridden by the demuxer.
Definition: decode.c:2003
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
Definition: codec_internal.h:54
AVFrameSideData::data
uint8_t * data
Definition: frame.h:267
a0
static double a0(void *priv, double x, double y)
Definition: vf_xfade.c:2028
offset
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 offset
Definition: writing_filters.txt:86
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: packet.c:64
avcodec_send_packet
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Definition: decode.c:704
AV_CODEC_ID_CRI
@ AV_CODEC_ID_CRI
Definition: codec_id.h:312
CRIContext::data_size
unsigned data_size
Definition: cri.c:48
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
display.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:498
AVCodecContext::idct_algo
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
Definition: avcodec.h:1526
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
cri_decode_frame
static int cri_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition: cri.c:170
avcodec.h
stride
#define stride
Definition: h264pred_template.c:536
ret
ret
Definition: filter_design.txt:187
pos
unsigned int pos
Definition: spdifenc.c:414
AVCodecContext
main external API structure.
Definition: avcodec.h:431
AVRational::den
int den
Denominator.
Definition: rational.h:60
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
CRIContext::color_model
int color_model
Definition: cri.c:46
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:265
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
AVPacket
This structure stores compressed data.
Definition: packet.h:512
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
int32_t
int32_t
Definition: audioconvert.c:56
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:455
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
a1
static double a1(void *priv, double x, double y)
Definition: vf_xfade.c:2029
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
h
h
Definition: vp9dsp_template.c:2070
width
#define width
Definition: dsp.h:85
AV_PIX_FMT_BAYER_RGGB16
#define AV_PIX_FMT_BAYER_RGGB16
Definition: pixfmt.h:555
CRIContext::gb
GetByteContext gb
Definition: cri.c:45
cri_decode_close
static av_cold int cri_decode_close(AVCodecContext *avctx)
Definition: cri.c:416
skip
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
Definition: bitstream_template.h:375
src
#define src
Definition: vp8dsp.c:248