FFmpeg
apv_decode.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
20 #include "libavutil/mem_internal.h"
21 #include "libavutil/pixdesc.h"
22 
23 #include "apv.h"
24 #include "apv_decode.h"
25 #include "apv_dsp.h"
26 #include "avcodec.h"
27 #include "cbs.h"
28 #include "cbs_apv.h"
29 #include "codec_internal.h"
30 #include "decode.h"
31 #include "internal.h"
32 #include "thread.h"
33 
34 
35 typedef struct APVDecodeContext {
38 
41 
43 
45 
49 
50 static const enum AVPixelFormat apv_format_table[5][5] = {
52  { 0 }, // 4:2:0 is not valid.
56 };
57 
60 {
61  int err, bit_depth;
62 
63  avctx->profile = header->frame_info.profile_idc;
64  avctx->level = header->frame_info.level_idc;
65 
66  bit_depth = header->frame_info.bit_depth_minus8 + 8;
67  if (bit_depth < 8 || bit_depth > 16 || bit_depth % 2) {
68  avpriv_request_sample(avctx, "Bit depth %d", bit_depth);
69  return AVERROR_PATCHWELCOME;
70  }
71  avctx->pix_fmt =
72  apv_format_table[header->frame_info.chroma_format_idc][bit_depth - 4 >> 2];
73 
74  err = ff_set_dimensions(avctx,
75  FFALIGN(header->frame_info.frame_width, 16),
76  FFALIGN(header->frame_info.frame_height, 16));
77  if (err < 0) {
78  // Unsupported frame size.
79  return err;
80  }
81  avctx->width = header->frame_info.frame_width;
82  avctx->height = header->frame_info.frame_height;
83 
84  avctx->sample_aspect_ratio = (AVRational){ 1, 1 };
85 
86  avctx->color_primaries = header->color_primaries;
87  avctx->color_trc = header->transfer_characteristics;
88  avctx->colorspace = header->matrix_coefficients;
89  avctx->color_range = header->full_range_flag ? AVCOL_RANGE_JPEG
92 
93  avctx->refs = 0;
94  avctx->has_b_frames = 0;
95 
96  return 0;
97 }
98 
102 };
103 
105 {
106  APVDecodeContext *apv = avctx->priv_data;
107  int err;
108 
109  err = ff_cbs_init(&apv->cbc, AV_CODEC_ID_APV, avctx);
110  if (err < 0)
111  return err;
112 
113  apv->cbc->decompose_unit_types =
117 
118  // Extradata could be set here, but is ignored by the decoder.
119 
121 
122  ff_apv_dsp_init(&apv->dsp);
123 
124  return 0;
125 }
126 
128 {
129  APVDecodeContext *apv = avctx->priv_data;
130 
131  ff_cbs_fragment_free(&apv->au);
132  ff_cbs_close(&apv->cbc);
133 
134  return 0;
135 }
136 
138  void *output,
139  ptrdiff_t pitch,
140  GetBitContext *gbc,
141  APVEntropyState *entropy_state,
142  int bit_depth,
143  int qp_shift,
144  const uint16_t *qmatrix)
145 {
146  APVDecodeContext *apv = avctx->priv_data;
147  int err;
148 
149  LOCAL_ALIGNED_32(int16_t, coeff, [64]);
150 
151  err = ff_apv_entropy_decode_block(coeff, gbc, entropy_state);
152  if (err < 0)
153  return 0;
154 
155  apv->dsp.decode_transquant(output, pitch,
156  coeff, qmatrix,
157  bit_depth, qp_shift);
158 
159  return 0;
160 }
161 
163  int job, int thread)
164 {
166  APVDecodeContext *apv = avctx->priv_data;
167  const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
168  const APVDerivedTileInfo *tile_info = &apv_cbc->tile_info;
169 
170  int tile_index = job / apv_cbc->num_comp;
171  int comp_index = job % apv_cbc->num_comp;
172 
173  const AVPixFmtDescriptor *pix_fmt_desc =
175 
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;
178 
179  APVRawTile *tile = &input->tile[tile_index];
180 
181  int tile_y = tile_index / tile_info->tile_cols;
182  int tile_x = tile_index % tile_info->tile_cols;
183 
184  int tile_start_x = tile_info->col_starts[tile_x];
185  int tile_start_y = tile_info->row_starts[tile_y];
186 
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;
189 
190  int tile_mb_width = tile_width / APV_MB_WIDTH;
191  int tile_mb_height = tile_height / APV_MB_HEIGHT;
192 
193  int blk_mb_width = 2 / sub_w;
194  int blk_mb_height = 2 / sub_h;
195 
196  int bit_depth;
197  int qp_shift;
198  LOCAL_ALIGNED_32(uint16_t, qmatrix_scaled, [64]);
199 
200  GetBitContext gbc;
201 
202  APVEntropyState entropy_state = {
203  .log_ctx = avctx,
204  .decode_lut = &apv->decode_lut,
205  .prev_dc = 0,
206  .prev_dc_diff = 20,
207  .prev_1st_ac_level = 0,
208  };
209 
210  init_get_bits8(&gbc, tile->tile_data[comp_index],
211  tile->tile_header.tile_data_size[comp_index]);
212 
213  // Combine the bitstream quantisation matrix with the qp scaling
214  // in advance. (Including qp_shift as well would overflow 16 bits.)
215  // Fix the row ordering at the same time.
216  {
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];
220 
221  bit_depth = apv_cbc->bit_depth;
222  qp_shift = qp / 6;
223 
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];
228  }
229  }
230 
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 +
236  APV_MB_HEIGHT * mb_y +
237  APV_TR_SIZE * blk_y) / sub_h;
238  int frame_x = (tile_start_x +
239  APV_MB_WIDTH * mb_x +
240  APV_TR_SIZE * blk_x) / sub_w;
241 
242  ptrdiff_t frame_pitch = apv->output_frame->linesize[comp_index];
243  uint8_t *block_start = apv->output_frame->data[comp_index] +
244  frame_y * frame_pitch + 2 * frame_x;
245 
246  apv_decode_block(avctx,
247  block_start, frame_pitch,
248  &gbc, &entropy_state,
249  bit_depth,
250  qp_shift,
251  qmatrix_scaled);
252  }
253  }
254  }
255  }
256 
257  av_log(avctx, AV_LOG_DEBUG,
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);
261 
262  return 0;
263 }
264 
267 {
268  APVDecodeContext *apv = avctx->priv_data;
269  const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
270  const APVDerivedTileInfo *tile_info = &apv_cbc->tile_info;
271  int err, job_count;
272 
273  err = apv_decode_check_format(avctx, &input->frame_header);
274  if (err < 0) {
275  av_log(avctx, AV_LOG_ERROR, "Unsupported format parameters.\n");
276  return err;
277  }
278 
279  err = ff_thread_get_buffer(avctx, output, 0);
280  if (err) {
281  av_log(avctx, AV_LOG_ERROR, "No output frame supplied.\n");
282  return err;
283  }
284 
285  apv->output_frame = output;
286 
287  // Each component within a tile is independent of every other,
288  // so we can decode all in parallel.
289  job_count = tile_info->num_tiles * apv_cbc->num_comp;
290 
291  avctx->execute2(avctx, apv_decode_tile_component,
292  input, NULL, job_count);
293 
294  return 0;
295 }
296 
298  const APVRawMetadata *md)
299 {
300  int err;
301 
302  for (int i = 0; i < md->metadata_count; i++) {
303  const APVRawMetadataPayload *pl = &md->payloads[i];
304 
305  switch (pl->payload_type) {
306  case APV_METADATA_MDCV:
307  {
308  const APVRawMetadataMDCV *mdcv = &pl->mdcv;
310 
311  err = ff_decode_mastering_display_new(avctx, frame, &mdm);
312  if (err < 0)
313  return err;
314 
315  if (mdm) {
316  for (int i = 0; i < 3; i++) {
317  mdm->display_primaries[i][0] =
318  av_make_q(mdcv->primary_chromaticity_x[i], 1 << 16);
319  mdm->display_primaries[i][1] =
320  av_make_q(mdcv->primary_chromaticity_y[i], 1 << 16);
321  }
322 
323  mdm->white_point[0] =
324  av_make_q(mdcv->white_point_chromaticity_x, 1 << 16);
325  mdm->white_point[1] =
326  av_make_q(mdcv->white_point_chromaticity_y, 1 << 16);
327 
328  mdm->max_luminance =
329  av_make_q(mdcv->max_mastering_luminance, 1 << 8);
330  mdm->min_luminance =
331  av_make_q(mdcv->min_mastering_luminance, 1 << 14);
332 
333  mdm->has_primaries = 1;
334  mdm->has_luminance = 1;
335  }
336  }
337  break;
338  case APV_METADATA_CLL:
339  {
340  const APVRawMetadataCLL *cll = &pl->cll;
342 
343  err = ff_decode_content_light_new(avctx, frame, &clm);
344  if (err < 0)
345  return err;
346 
347  if (clm) {
348  clm->MaxCLL = cll->max_cll;
349  clm->MaxFALL = cll->max_fall;
350  }
351  }
352  break;
353  default:
354  // Ignore other types of metadata.
355  break;
356  }
357  }
358 
359  return 0;
360 }
361 
363  int *got_frame, AVPacket *packet)
364 {
365  APVDecodeContext *apv = avctx->priv_data;
366  CodedBitstreamFragment *au = &apv->au;
367  int err;
368 
369  err = ff_cbs_read_packet(apv->cbc, au, packet);
370  if (err < 0) {
371  av_log(avctx, AV_LOG_ERROR, "Failed to read packet.\n");
372  return err;
373  }
374 
375  for (int i = 0; i < au->nb_units; i++) {
376  CodedBitstreamUnit *pbu = &au->units[i];
377 
378  switch (pbu->type) {
380  err = apv_decode(avctx, frame, pbu->content);
381  if (err < 0)
382  return err;
383  *got_frame = 1;
384  break;
385  case APV_PBU_METADATA:
386  apv_decode_metadata(avctx, frame, pbu->content);
387  break;
390  case APV_PBU_DEPTH_FRAME:
391  case APV_PBU_ALPHA_FRAME:
392  if (!avctx->internal->is_copy &&
393  !apv->warned_additional_frames) {
394  av_log(avctx, AV_LOG_WARNING,
395  "Stream contains additional non-primary frames "
396  "which will be ignored by the decoder.\n");
397  apv->warned_additional_frames = 1;
398  }
399  break;
401  case APV_PBU_FILLER:
402  // Not relevant to the decoder.
403  break;
404  default:
405  if (!avctx->internal->is_copy &&
406  !apv->warned_unknown_pbu_types) {
407  av_log(avctx, AV_LOG_WARNING,
408  "Stream contains PBUs with unknown types "
409  "which will be ignored by the decoder.\n");
410  apv->warned_unknown_pbu_types = 1;
411  }
412  break;
413  }
414  }
415 
416  ff_cbs_fragment_reset(au);
417 
418  return packet->size;
419 }
420 
422  .p.name = "apv",
423  CODEC_LONG_NAME("Advanced Professional Video"),
424  .p.type = AVMEDIA_TYPE_VIDEO,
425  .p.id = AV_CODEC_ID_APV,
426  .priv_data_size = sizeof(APVDecodeContext),
430  .p.capabilities = AV_CODEC_CAP_DR1 |
433 };
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
cbs.h
APVRawMetadataCLL
Definition: cbs_apv.h:142
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AVMasteringDisplayMetadata::max_luminance
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:57
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
APVDecodeContext::dsp
APVDSPContext dsp
Definition: apv_decode.c:37
APV_PBU_PREVIEW_FRAME
@ APV_PBU_PREVIEW_FRAME
Definition: apv.h:29
CodedBitstreamContext::priv_data
void * priv_data
Internal codec-specific data.
Definition: cbs.h:247
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:659
mem_internal.h
APVDecodeContext::output_frame
AVFrame * output_frame
Definition: apv_decode.c:44
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3341
AVMasteringDisplayMetadata::display_primaries
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
Definition: mastering_display_metadata.h:42
AVMasteringDisplayMetadata::has_luminance
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Definition: mastering_display_metadata.h:67
CodedBitstreamUnit::content
void * content
Pointer to the decomposed form of this unit.
Definition: cbs.h:114
output
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
Definition: filter_design.txt:225
APVDecodeContext
Definition: apv_decode.c:35
ff_apv_entropy_decode_block
int ff_apv_entropy_decode_block(int16_t *coeff, GetBitContext *gbc, APVEntropyState *state)
Entropy decode a single 8x8 block to coefficients.
Definition: apv_entropy.c:104
md
#define md
Definition: vf_colormatrix.c:101
AVContentLightMetadata::MaxCLL
unsigned MaxCLL
Max content light level (cd/m^2).
Definition: mastering_display_metadata.h:111
apv_decode.h
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:410
pixdesc.h
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:652
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:750
APV_PBU_METADATA
@ APV_PBU_METADATA
Definition: apv.h:33
internal.h
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:226
data
const char data[16]
Definition: mxf.c:149
FFCodec
Definition: codec_internal.h:127
apv_decode_block
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)
Definition: apv_decode.c:137
CodedBitstreamUnit::type
CodedBitstreamUnitType type
Codec-specific type of this unit.
Definition: cbs.h:81
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:246
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
thread.h
APVDecodeContext::tile_info
APVDerivedTileInfo tile_info
Definition: apv_decode.c:40
APVRawMetadataMDCV::max_mastering_luminance
uint32_t max_mastering_luminance
Definition: cbs_apv.h:138
CodedBitstreamUnit
Coded bitstream unit structure.
Definition: cbs.h:77
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:431
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:107
AVCodecInternal::is_copy
int is_copy
When using frame-threaded decoding, this field is set for the first worker thread (e....
Definition: internal.h:54
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
CodedBitstreamAPVContext::num_comp
int num_comp
Definition: cbs_apv.h:202
tile_info
static int FUNC() tile_info(CodedBitstreamContext *ctx, RWContext *rw, APVRawTileInfo *current, const APVRawFrameHeader *fh)
Definition: cbs_apv_syntax_template.c:111
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:580
GetBitContext
Definition: get_bits.h:108
apv_decode_init
static av_cold int apv_decode_init(AVCodecContext *avctx)
Definition: apv_decode.c:104
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:689
APVRawMetadataMDCV::primary_chromaticity_y
uint16_t primary_chromaticity_y[3]
Definition: cbs_apv.h:135
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:511
apv_decode_tile_component
static int apv_decode_tile_component(AVCodecContext *avctx, void *data, int job, int thread)
Definition: apv_decode.c:162
APVDSPContext
Definition: apv_dsp.h:26
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:531
CodedBitstreamFragment::units
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
Definition: cbs.h:175
APVRawMetadataPayload::cll
APVRawMetadataCLL cll
Definition: cbs_apv.h:171
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:645
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:540
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:528
APV_PBU_NON_PRIMARY_FRAME
@ APV_PBU_NON_PRIMARY_FRAME
Definition: apv.h:28
apv_dsp.h
apv_decode
static int apv_decode(AVCodecContext *avctx, AVFrame *output, APVRawFrame *input)
Definition: apv_decode.c:265
AVCodecContext::has_b_frames
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:697
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:129
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:341
AVMasteringDisplayMetadata::white_point
AVRational white_point[2]
CIE 1931 xy chromaticity coords of white point.
Definition: mastering_display_metadata.h:47
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:541
apv_decode_frame
static int apv_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *packet)
Definition: apv_decode.c:362
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
CodedBitstreamUnitType
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition: cbs.h:54
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:577
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
APVDecodeContext::au
CodedBitstreamFragment au
Definition: apv_decode.c:39
decode.h
APVRawMetadataMDCV::white_point_chromaticity_y
uint16_t white_point_chromaticity_y
Definition: cbs_apv.h:137
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:510
AVPixFmtDescriptor::log2_chroma_w
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
APV_MB_HEIGHT
@ APV_MB_HEIGHT
Definition: apv.h:41
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:326
APVDecodeContext::decode_lut
APVVLCLUT decode_lut
Definition: apv_decode.c:42
ff_decode_mastering_display_new
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...
Definition: decode.c:2082
APVRawMetadataMDCV::white_point_chromaticity_x
uint16_t white_point_chromaticity_x
Definition: cbs_apv.h:136
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:508
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:95
APVRawMetadataCLL::max_cll
uint16_t max_cll
Definition: cbs_apv.h:143
APVRawMetadata
Definition: cbs_apv.h:178
NULL
#define NULL
Definition: coverity.c:32
APV_MB_WIDTH
@ APV_MB_WIDTH
Definition: apv.h:40
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:132
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:669
APV_PBU_ACCESS_UNIT_INFORMATION
@ APV_PBU_ACCESS_UNIT_INFORMATION
Definition: apv.h:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCHROMA_LOC_TOPLEFT
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:773
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:466
APV_METADATA_CLL
@ APV_METADATA_CLL
Definition: apv.h:84
APVRawMetadataCLL::max_fall
uint16_t max_fall
Definition: cbs_apv.h:144
CodedBitstreamAPVContext::bit_depth
int bit_depth
Definition: cbs_apv.h:201
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:529
ff_apv_entropy_build_decode_lut
void ff_apv_entropy_build_decode_lut(APVVLCLUT *decode_lut)
Build the decoder VLC look-up table.
Definition: apv_entropy.c:23
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
close
av_cold void CBS_FUNC() close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
Definition: cbs.c:146
AVCodecContext::level
int level
Encoding level descriptor.
Definition: avcodec.h:1628
APVRawFrame
Definition: cbs_apv.h:101
APVRawMetadataPayload
Definition: cbs_apv.h:165
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
codec_internal.h
APVRawFrameHeader
Definition: cbs_apv.h:67
apv_decode_check_format
static int apv_decode_check_format(AVCodecContext *avctx, const APVRawFrameHeader *header)
Definition: apv_decode.c:58
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:533
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
APVEntropyState
Definition: apv_decode.h:46
ff_apv_dsp_init
av_cold void ff_apv_dsp_init(APVDSPContext *dsp)
Definition: apv_dsp.c:133
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:535
APVEntropyState::log_ctx
void * log_ctx
Definition: apv_decode.h:47
apv.h
APVRawMetadataPayload::payload_type
uint32_t payload_type
Definition: cbs_apv.h:166
header
static const uint8_t header[24]
Definition: sdr2.c:68
CodedBitstreamAPVContext
Definition: cbs_apv.h:200
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
AV_CODEC_CAP_SLICE_THREADS
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: codec.h:99
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:575
APVDecodeContext::warned_unknown_pbu_types
uint8_t warned_unknown_pbu_types
Definition: apv_decode.c:47
input
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
Definition: filter_design.txt:172
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
apv_decode_close
static av_cold int apv_decode_close(AVCodecContext *avctx)
Definition: apv_decode.c:127
apv_format_table
static enum AVPixelFormat apv_format_table[5][5]
Definition: apv_decode.c:50
APVRawMetadataPayload::mdcv
APVRawMetadataMDCV mdcv
Definition: cbs_apv.h:170
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:676
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
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
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:733
APVRawMetadataMDCV::primary_chromaticity_x
uint16_t primary_chromaticity_x[3]
Definition: cbs_apv.h:134
avcodec.h
APVDerivedTileInfo
Definition: cbs_apv.h:190
AV_CODEC_ID_APV
@ AV_CODEC_ID_APV
Definition: codec_id.h:332
frame
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
Definition: filter_design.txt:264
ff_apv_decoder
const FFCodec ff_apv_decoder
Definition: apv_decode.c:421
APVVLCLUT
Definition: apv_decode.h:42
CodedBitstreamAPVContext::tile_info
APVDerivedTileInfo tile_info
Definition: cbs_apv.h:204
ff_decode_content_light_new
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...
Definition: decode.c:2127
AVCodecContext
main external API structure.
Definition: avcodec.h:431
APV_PBU_PRIMARY_FRAME
@ APV_PBU_PRIMARY_FRAME
Definition: apv.h:27
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1618
tile
static int FUNC() tile(CodedBitstreamContext *ctx, RWContext *rw, APVRawTile *current, int tile_idx)
Definition: cbs_apv_syntax_template.c:214
APVRawMetadataMDCV
Definition: cbs_apv.h:133
APV_METADATA_MDCV
@ APV_METADATA_MDCV
Definition: apv.h:83
APVDecodeContext::warned_additional_frames
uint8_t warned_additional_frames
Definition: apv_decode.c:46
AVMasteringDisplayMetadata::min_luminance
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:52
APV_PBU_FILLER
@ APV_PBU_FILLER
Definition: apv.h:34
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
APV_TR_SIZE
@ APV_TR_SIZE
Definition: apv.h:42
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
apv_decompose_unit_types
static const CodedBitstreamUnitType apv_decompose_unit_types[]
Definition: apv_decode.c:99
mastering_display_metadata.h
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:37
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
APVDecodeContext::cbc
CodedBitstreamContext * cbc
Definition: apv_decode.c:36
APV_PBU_DEPTH_FRAME
@ APV_PBU_DEPTH_FRAME
Definition: apv.h:30
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVPacket
This structure stores compressed data.
Definition: packet.h:512
AVContentLightMetadata::MaxFALL
unsigned MaxFALL
Max average light level per frame (cd/m^2).
Definition: mastering_display_metadata.h:116
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
CodedBitstreamContext::nb_decompose_unit_types
int nb_decompose_unit_types
Length of the decompose_unit_types array.
Definition: cbs.h:259
CodedBitstreamContext::decompose_unit_types
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
Definition: cbs.h:255
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
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
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:80
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
APV_PBU_ALPHA_FRAME
@ APV_PBU_ALPHA_FRAME
Definition: apv.h:31
apv_decode_metadata
static int apv_decode_metadata(AVCodecContext *avctx, AVFrame *frame, const APVRawMetadata *md)
Definition: apv_decode.c:297
APVRawMetadataMDCV::min_mastering_luminance
uint32_t min_mastering_luminance
Definition: cbs_apv.h:139
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:509
APVRawTile
Definition: cbs_apv.h:93
cbs_apv.h
AVCodecContext::execute2
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.
Definition: avcodec.h:1610
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:616
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
CodedBitstreamFragment::nb_units
int nb_units
Number of units in this fragment.
Definition: cbs.h:160
APVDSPContext::decode_transquant
void(* decode_transquant)(void *output, ptrdiff_t pitch, const int16_t *input, const int16_t *qmatrix, int bit_depth, int qp_shift)
Definition: apv_dsp.h:27