FFmpeg  4.0
Data Structures | Macros | Functions | Variables
proresdec_lgpl.c File Reference

This is a decoder for Apple ProRes 422 SD/HQ/LT/Proxy and ProRes 4444. More...

#include <stdint.h>
#include "libavutil/intmath.h"
#include "avcodec.h"
#include "idctdsp.h"
#include "internal.h"
#include "proresdata.h"
#include "proresdsp.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  ProresThreadData
 
struct  ProresContext
 

Macros

#define LONG_BITSTREAM_READER
 
#define LSB2SIGN(x)   (-((x) & 1))
 
#define TOSIGNED(x)   (((x) >> 1) ^ LSB2SIGN(x))
 
#define MAX_PADDING   16
 
#define MOVE_DATA_PTR(nbytes)   buf += (nbytes); buf_size -= (nbytes)
 

Functions

static av_cold int decode_init (AVCodecContext *avctx)
 
static int decode_frame_header (ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx)
 
static int decode_picture_header (ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx)
 
static int decode_vlc_codeword (GetBitContext *gb, unsigned codebook)
 Read an unsigned rice/exp golomb codeword. More...
 
static void decode_dc_coeffs (GetBitContext *gb, int16_t *out, int nblocks)
 Decode DC coefficients for all blocks in a slice. More...
 
static int decode_ac_coeffs (GetBitContext *gb, int16_t *out, int blocks_per_slice, int plane_size_factor, const uint8_t *scan)
 Decode AC coefficients for all blocks in a slice. More...
 
static int decode_slice_plane (ProresContext *ctx, ProresThreadData *td, const uint8_t *buf, int data_size, uint16_t *out_ptr, int linesize, int mbs_per_slice, int blocks_per_mb, int plane_size_factor, const int16_t *qmat, int is_chroma)
 Decode a slice plane (luma or chroma). More...
 
static void unpack_alpha (GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits)
 
static void decode_alpha_plane (ProresContext *ctx, ProresThreadData *td, const uint8_t *buf, int data_size, uint16_t *out_ptr, int linesize, int mbs_per_slice)
 Decode alpha slice plane. More...
 
static int decode_slice (AVCodecContext *avctx, void *tdata)
 
static int decode_picture (ProresContext *ctx, int pic_num, AVCodecContext *avctx)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int decode_close (AVCodecContext *avctx)
 

Variables

AVCodec ff_prores_lgpl_decoder
 

Detailed Description

This is a decoder for Apple ProRes 422 SD/HQ/LT/Proxy and ProRes 4444.

It is used for storing and editing high definition video data in Apple's Final Cut Pro.

See also
http://wiki.multimedia.cx/index.php?title=Apple_ProRes

Definition in file proresdec_lgpl.c.

Macro Definition Documentation

◆ LONG_BITSTREAM_READER

#define LONG_BITSTREAM_READER

Definition at line 31 of file proresdec_lgpl.c.

◆ LSB2SIGN

#define LSB2SIGN (   x)    (-((x) & 1))

Definition at line 340 of file proresdec_lgpl.c.

◆ TOSIGNED

#define TOSIGNED (   x)    (((x) >> 1) ^ LSB2SIGN(x))

Definition at line 341 of file proresdec_lgpl.c.

Referenced by decode_dc_coeffs().

◆ MAX_PADDING

#define MAX_PADDING   16

Definition at line 370 of file proresdec_lgpl.c.

Referenced by decode_ac_coeffs().

◆ MOVE_DATA_PTR

#define MOVE_DATA_PTR (   nbytes)    buf += (nbytes); buf_size -= (nbytes)

Definition at line 715 of file proresdec_lgpl.c.

Referenced by decode_frame().

Function Documentation

◆ decode_init()

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 81 of file proresdec_lgpl.c.

◆ decode_frame_header()

static int decode_frame_header ( ProresContext ctx,
const uint8_t buf,
const int  data_size,
AVCodecContext avctx 
)
static

Definition at line 99 of file proresdec_lgpl.c.

Referenced by decode_frame().

◆ decode_picture_header()

static int decode_picture_header ( ProresContext ctx,
const uint8_t buf,
const int  data_size,
AVCodecContext avctx 
)
static

Definition at line 218 of file proresdec_lgpl.c.

Referenced by decode_frame().

◆ decode_vlc_codeword()

static int decode_vlc_codeword ( GetBitContext gb,
unsigned  codebook 
)
inlinestatic

Read an unsigned rice/exp golomb codeword.

Definition at line 302 of file proresdec_lgpl.c.

Referenced by decode_ac_coeffs(), and decode_dc_coeffs().

◆ decode_dc_coeffs()

static void decode_dc_coeffs ( GetBitContext gb,
int16_t *  out,
int  nblocks 
)
inlinestatic

Decode DC coefficients for all blocks in a slice.

Definition at line 346 of file proresdec_lgpl.c.

Referenced by decode_slice_plane().

◆ decode_ac_coeffs()

static int decode_ac_coeffs ( GetBitContext gb,
int16_t *  out,
int  blocks_per_slice,
int  plane_size_factor,
const uint8_t scan 
)
inlinestatic

Decode AC coefficients for all blocks in a slice.

Definition at line 375 of file proresdec_lgpl.c.

Referenced by decode_slice_plane().

◆ decode_slice_plane()

static int decode_slice_plane ( ProresContext ctx,
ProresThreadData td,
const uint8_t buf,
int  data_size,
uint16_t *  out_ptr,
int  linesize,
int  mbs_per_slice,
int  blocks_per_mb,
int  plane_size_factor,
const int16_t *  qmat,
int  is_chroma 
)
static

Decode a slice plane (luma or chroma).

Definition at line 426 of file proresdec_lgpl.c.

Referenced by decode_slice().

◆ unpack_alpha()

static void unpack_alpha ( GetBitContext gb,
uint16_t *  dst,
int  num_coeffs,
const int  num_bits 
)
static

Definition at line 486 of file proresdec_lgpl.c.

Referenced by decode_alpha_plane().

◆ decode_alpha_plane()

static void decode_alpha_plane ( ProresContext ctx,
ProresThreadData td,
const uint8_t buf,
int  data_size,
uint16_t *  out_ptr,
int  linesize,
int  mbs_per_slice 
)
static

Decode alpha slice plane.

Definition at line 532 of file proresdec_lgpl.c.

Referenced by decode_slice().

◆ decode_slice()

static int decode_slice ( AVCodecContext avctx,
void tdata 
)
static

Definition at line 559 of file proresdec_lgpl.c.

Referenced by decode_picture().

◆ decode_picture()

static int decode_picture ( ProresContext ctx,
int  pic_num,
AVCodecContext avctx 
)
static

Definition at line 684 of file proresdec_lgpl.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( AVCodecContext avctx,
void data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 717 of file proresdec_lgpl.c.

◆ decode_close()

static av_cold int decode_close ( AVCodecContext avctx)
static

Definition at line 765 of file proresdec_lgpl.c.

Variable Documentation

◆ ff_prores_lgpl_decoder

AVCodec ff_prores_lgpl_decoder
Initial value:
= {
.name = "prores_lgpl",
.long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
.priv_data_size = sizeof(ProresContext),
.close = decode_close,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold int decode_close(AVCodecContext *avctx)
static av_cold int decode_init(AVCodecContext *avctx)
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1019
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959

Definition at line 775 of file proresdec_lgpl.c.