Go to the documentation of this file.
28 #define BITSTREAM_READER_LE
71 s->jpeg_avctx->flags = avctx->
flags;
72 s->jpeg_avctx->flags2 = avctx->
flags2;
91 a0 = bytestream2_get_le32(gb);
92 a1 = bytestream2_get_le32(gb);
93 a2 = bytestream2_get_le32(gb);
94 a3 = bytestream2_get_le32(gb);
177 int ret,
bps, hflip = 0, vflip = 0;
187 char codec_name[1024];
188 uint32_t
key, length;
192 key = bytestream2_get_le32(gb);
193 length = bytestream2_get_le32(gb);
200 if (bytestream2_get_le32(gb) !=
MKTAG(
'D',
'V',
'C',
'C'))
206 width = bytestream2_get_le32(gb);
207 height = bytestream2_get_le32(gb);
208 s->color_model = bytestream2_get_le32(gb);
209 if (bytestream2_get_le32(gb) != 1)
220 if (bytestream2_get_le32(gb) != 0)
225 length -=
FFMIN(length,
sizeof(codec_name) - 1);
226 if (strncmp(codec_name,
"cintel_craw",
FFMIN(length,
sizeof(codec_name) - 1)))
234 s->data_size = length;
239 hflip = bytestream2_get_byte(gb) != 0;
245 vflip = bytestream2_get_byte(gb) != 0;
259 for (
int i = 0;
i < 4;
i++)
260 s->tile_size[
i] = bytestream2_get_le64(gb);
269 switch (
s->color_model) {
289 switch (
s->color_model) {
310 for (
int i = 0;
i < 4;
i++) {
311 if (
s->tile_size[
i] >=
s->data_size)
315 if (
s->tile_size[0] +
s->tile_size[1] +
s->tile_size[2] +
s->tile_size[3] !=
320 if (!
s->data || !
s->data_size)
331 if (!compressed &&
s->color_model == 45) {
332 uint16_t *
dst = (uint16_t *)p->
data[0];
337 }
else if (!compressed) {
345 for (
int y = 0; y < avctx->
height; y++) {
351 for (
int x = 0; x < avctx->
width; x++)
357 for (
int tile = 0; tile < 4; tile++) {
359 s->jpkt->data = (uint8_t *)
s->data +
offset;
360 s->jpkt->size =
s->tile_size[tile];
370 s->jpeg_avctx->width * 2 != avctx->
width ||
371 s->jpeg_avctx->height * 2 != avctx->
height) {
374 "JPEG decoding error (%d).\n",
ret);
377 "JPEG invalid format.\n");
388 for (
int y = 0; y <
s->jpeg_avctx->height; y++) {
389 const int hw =
s->jpgframe->width / 2;
390 uint16_t *
dst = (uint16_t *)(p->
data[0] + (y * 2) * p->
linesize[0] + tile * hw * 2);
391 const uint16_t *
src = (
const uint16_t *)(
s->jpgframe->data[0] + y *
s->jpgframe->linesize[0]);
404 if (hflip || vflip) {
406 sizeof(
int32_t) * 9, &rotation);
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_EF_EXPLODE
abort decoding on minor error detection
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
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
static void unpack_10bit(GetByteContext *gb, uint16_t *dst, int shift, int w, int h, ptrdiff_t stride)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
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...
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
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.
#define AV_PIX_FMT_BAYER_GRBG16
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const FFCodec ff_cri_decoder
AVCodec p
The public AVCodec.
enum AVDiscard skip_frame
Skip decoding for selected frames.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
int flags
AV_CODEC_FLAG_*.
#define AV_PIX_FMT_GRAY16
static double a2(void *priv, double x, double y)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define FF_CODEC_DECODE_CB(func)
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
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...
static av_cold int cri_decode_init(AVCodecContext *avctx)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define CODEC_LONG_NAME(str)
#define AV_PIX_FMT_BAYER_BGGR16
AVCodecContext * jpeg_avctx
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
@ AVDISCARD_ALL
discard all
static double a3(void *priv, double x, double y)
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
#define AV_PIX_FMT_BAYER_GBRG16
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int flags2
AV_CODEC_FLAG2_*.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static int shift(int a, int b)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
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.
#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...
static double a0(void *priv, double x, double y)
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
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
#define i(width, name, range_min, range_max)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int cri_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
main external API structure.
Structure to hold side data for an AVFrame.
This structure stores compressed data.
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static double a1(void *priv, double x, double y)
#define MKTAG(a, b, c, d)
#define AV_PIX_FMT_BAYER_RGGB16
static av_cold int cri_decode_close(AVCodecContext *avctx)
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.