Go to the documentation of this file.
67 if (bit_depth < 8 || bit_depth > 16 ||
bit_depth % 2) {
131 ff_cbs_fragment_free(&apv->
au);
132 ff_cbs_close(&apv->
cbc);
144 const uint16_t *qmatrix)
170 int tile_index = job / apv_cbc->
num_comp;
171 int comp_index = job % apv_cbc->
num_comp;
176 int sub_w = comp_index == 0 ? 1 : pix_fmt_desc->
log2_chroma_w + 1;
177 int sub_h = comp_index == 0 ? 1 : pix_fmt_desc->
log2_chroma_h + 1;
181 int tile_y = tile_index /
tile_info->tile_cols;
182 int tile_x = tile_index %
tile_info->tile_cols;
184 int tile_start_x =
tile_info->col_starts[tile_x];
185 int tile_start_y =
tile_info->row_starts[tile_y];
187 int tile_width =
tile_info->col_starts[tile_x + 1] - tile_start_x;
188 int tile_height =
tile_info->row_starts[tile_y + 1] - tile_start_y;
193 int blk_mb_width = 2 / sub_w;
194 int blk_mb_height = 2 / sub_h;
207 .prev_1st_ac_level = 0,
211 tile->tile_header.tile_data_size[comp_index]);
217 static const uint8_t apv_level_scale[6] = { 40, 45, 51, 57, 64, 71 };
218 int qp =
tile->tile_header.tile_qp[comp_index];
219 int level_scale = apv_level_scale[qp % 6];
224 for (
int y = 0; y < 8; y++) {
225 for (
int x = 0; x < 8; x++)
226 qmatrix_scaled[y * 8 + x] = level_scale *
227 input->frame_header.quantization_matrix.q_matrix[comp_index][x][y];
231 for (
int mb_y = 0; mb_y < tile_mb_height; mb_y++) {
232 for (
int mb_x = 0; mb_x < tile_mb_width; mb_x++) {
233 for (
int blk_y = 0; blk_y < blk_mb_height; blk_y++) {
234 for (
int blk_x = 0; blk_x < blk_mb_width; blk_x++) {
235 int frame_y = (tile_start_y +
238 int frame_x = (tile_start_x +
244 frame_y * frame_pitch + 2 * frame_x;
247 block_start, frame_pitch,
248 &gbc, &entropy_state,
258 "Decoded tile %d component %d: %dx%d MBs starting at (%d,%d)\n",
259 tile_index, comp_index, tile_mb_width, tile_mb_height,
260 tile_start_x, tile_start_y);
302 for (
int i = 0;
i <
md->metadata_count;
i++) {
316 for (
int i = 0;
i < 3;
i++) {
369 err = ff_cbs_read_packet(apv->
cbc, au, packet);
395 "Stream contains additional non-primary frames "
396 "which will be ignored by the decoder.\n");
408 "Stream contains PBUs with unknown types "
409 "which will be ignored by the decoder.\n");
416 ff_cbs_fragment_reset(au);
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
void * priv_data
Internal codec-specific data.
enum AVColorSpace colorspace
YUV colorspace type.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
void * content
Pointer to the decomposed form of this unit.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
int ff_apv_entropy_decode_block(int16_t *coeff, GetBitContext *gbc, APVEntropyState *state)
Entropy decode a single 8x8 block to coefficients.
unsigned MaxCLL
Max content light level (cd/m^2).
This structure describes decoded (raw) audio or video data.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
@ AVCOL_RANGE_JPEG
Full range content.
Context structure for coded bitstream operations.
static int apv_decode_block(AVCodecContext *avctx, void *output, ptrdiff_t pitch, GetBitContext *gbc, APVEntropyState *entropy_state, int bit_depth, int qp_shift, const uint16_t *qmatrix)
CodedBitstreamUnitType type
Codec-specific type of this unit.
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
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.
APVDerivedTileInfo tile_info
Coded bitstream unit structure.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
int is_copy
When using frame-threaded decoding, this field is set for the first worker thread (e....
AVCodec p
The public AVCodec.
static int FUNC() tile_info(CodedBitstreamContext *ctx, RWContext *rw, APVRawTileInfo *current, const APVRawFrameHeader *fh)
#define AV_PIX_FMT_YUVA444P16
static av_cold int apv_decode_init(AVCodecContext *avctx)
int refs
number of reference frames
#define AV_PIX_FMT_GRAY16
static int apv_decode_tile_component(AVCodecContext *avctx, void *data, int job, int thread)
#define AV_PIX_FMT_YUV444P10
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
#define AV_PIX_FMT_YUV422P16
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
@ APV_PBU_NON_PRIMARY_FRAME
static int apv_decode(AVCodecContext *avctx, AVFrame *output, APVRawFrame *input)
int has_b_frames
Size of the frame reordering buffer in the decoder.
Coded bitstream fragment structure, combining one or more units.
#define FF_CODEC_DECODE_CB(func)
#define AV_PIX_FMT_YUV444P16
static int apv_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *packet)
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
#define AV_PIX_FMT_YUVA444P12
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
CodedBitstreamFragment au
#define AV_PIX_FMT_GRAY14
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define CODEC_LONG_NAME(str)
int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame *frame, AVMasteringDisplayMetadata **mdm)
Wrapper around av_mastering_display_metadata_create_side_data(), which rejects side data overridden b...
#define AV_PIX_FMT_GRAY10
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define LOCAL_ALIGNED_32(t, v,...)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
@ APV_PBU_ACCESS_UNIT_INFORMATION
Rational number (pair of numerator and denominator).
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
struct AVCodecInternal * internal
Private context used for internal data.
#define AV_PIX_FMT_YUV422P10
void ff_apv_entropy_build_decode_lut(APVVLCLUT *decode_lut)
Build the decoder VLC look-up table.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
av_cold void CBS_FUNC() close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
int level
Encoding level descriptor.
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 apv_decode_check_format(AVCodecContext *avctx, const APVRawFrameHeader *header)
#define AV_PIX_FMT_YUV422P12
static AVRational av_make_q(int num, int den)
Create an AVRational.
av_cold void ff_apv_dsp_init(APVDSPContext *dsp)
#define AV_PIX_FMT_YUV444P12
static const uint8_t header[24]
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define AV_PIX_FMT_YUVA444P10
uint8_t warned_unknown_pbu_types
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
#define i(width, name, range_min, range_max)
static av_cold int apv_decode_close(AVCodecContext *avctx)
static enum AVPixelFormat apv_format_table[5][5]
const char * name
Name of the codec implementation.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
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
const FFCodec ff_apv_decoder
APVDerivedTileInfo tile_info
int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame, AVContentLightMetadata **clm)
Wrapper around av_content_light_metadata_create_side_data(), which rejects side data overridden by th...
main external API structure.
static int FUNC() tile(CodedBitstreamContext *ctx, RWContext *rw, APVRawTile *current, int tile_idx)
uint8_t warned_additional_frames
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static const CodedBitstreamUnitType apv_decompose_unit_types[]
#define avpriv_request_sample(...)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
CodedBitstreamContext * cbc
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
int nb_decompose_unit_types
Length of the decompose_unit_types array.
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static const double coeff[2][5]
static int apv_decode_metadata(AVCodecContext *avctx, AVFrame *frame, const APVRawMetadata *md)
#define AV_PIX_FMT_GRAY12
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
int nb_units
Number of units in this fragment.
void(* decode_transquant)(void *output, ptrdiff_t pitch, const int16_t *input, const int16_t *qmatrix, int bit_depth, int qp_shift)