Go to the documentation of this file.
26 #include "config_components.h"
73 if (level < -128 || level > 127) {
89 for (
i = 0;
i < 10;
i++) {
94 a->q_intra_matrix[
index + 0] + (1 << 15)) >> 16))
97 a->q_intra_matrix[
index + 8] + (1 << 15)) >> 16))
100 a->q_intra_matrix[
index + 1] + (1 << 15)) >> 16))
103 a->q_intra_matrix[
index + 9] + (1 << 15)) >> 16))
107 for (; nc_count; nc_count--)
132 for (count = 63; count > 3; count--) {
144 for (
i = 0;
i <= count;
i++) {
149 a->q_intra_matrix[
index + 0] + (1 << 15)) >> 16))
152 a->q_intra_matrix[
index + 8] + (1 << 15)) >> 16))
155 a->q_intra_matrix[
index + 1] + (1 << 15)) >> 16))
158 a->q_intra_matrix[
index + 9] + (1 << 15)) >> 16))
180 #define MAX_MB_SIZE (30 * 16 * 16 * 3 / 2 / 8)
189 for (
i = 0;
i < 6;
i++)
192 for (
i = 0;
i < 6;
i++) {
202 int16_t (*
block)[64] =
a->block;
206 const uint8_t *ptr_y =
frame->
data[0] + (mb_y * 16 * linesize) + mb_x * 16;
210 a->pdsp.get_pixels(
block[0], ptr_y, linesize);
211 a->pdsp.get_pixels(
block[1], ptr_y + 8, linesize);
212 a->pdsp.get_pixels(
block[2], ptr_y + 8 * linesize, linesize);
213 a->pdsp.get_pixels(
block[3], ptr_y + 8 * linesize + 8, linesize);
214 for (
i = 0;
i < 4;
i++)
220 for (
i = 4;
i < 6;
i++)
226 const AVFrame *pict,
int *got_packet)
253 for (
i = 0;
i<3;
i++) {
280 for (
int mb_y = 0; mb_y <
c->mb_height2; mb_y++) {
281 for (
int mb_x = 0; mb_x <
c->mb_width2; mb_x++) {
287 if (
c->mb_width2 !=
c->mb_width) {
288 int mb_x =
c->mb_width2;
289 for (
int mb_y = 0; mb_y <
c->mb_height2; mb_y++) {
295 if (
c->mb_height2 !=
c->mb_height) {
296 int mb_y =
c->mb_height2;
297 for (
int mb_x = 0; mb_x <
c->mb_width; mb_x++) {
311 c->bbdsp.bswap_buf((uint32_t *)
pkt->
data,
345 for (
i = 0;
i < 64;
i++) {
348 a->q_intra_matrix[
i] = (((
int64_t)inv_qscale << 30) + q / 2) / q;
351 a->q_intra_matrix[
i] = ((inv_qscale << 16) + q / 2) / q;
358 #if CONFIG_ASV1_ENCODER
373 #if CONFIG_ASV2_ENCODER
#define AV_LOG_WARNING
Something somehow does not look correct.
const uint8_t ff_asv_dc_ccp_tab[8][2]
AVPixelFormat
Pixel format.
static void asv1_put_level(PutBitContext *pb, int level)
const uint8_t ff_asv_level_tab[7][2]
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
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
static int put_bytes_output(const PutBitContext *s)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
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.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)
#define FF_INPUT_BUFFER_MIN_SIZE
Used by some encoders as upper bound for the length of headers.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const uint16_t ff_asv2_level_tab[63][2]
AVCodec p
The public AVCodec.
static void asv1_encode_block(ASVEncContext *a, int16_t block[64])
const uint8_t ff_asv_scantab[64]
static void asv2_encode_block(ASVEncContext *a, int16_t block[64])
#define FF_CODEC_ENCODE_CB(func)
static int put_bytes_left(const PutBitContext *s, int round_up)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static av_cold int encode_init(AVCodecContext *avctx)
const FFCodec ff_asv2_encoder
av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
const FFCodec ff_asv1_encoder
int global_quality
Global quality for codecs which cannot change it per frame.
#define AV_CEIL_RSHIFT(a, b)
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
static int encode_mb(ASVEncContext *a, int16_t block[6][64])
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define CODEC_LONG_NAME(str)
const uint8_t ff_asv_ac_ccp_tab[16][2]
static void flush_put_bits_le(PutBitContext *s)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define DECLARE_ALIGNED(n, t, v)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
const uint16_t ff_mpeg1_default_intra_matrix[256]
av_cold void ff_asv_common_init(AVCodecContext *avctx)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
void ff_fdct_ifast(int16_t *data)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
main external API structure.
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
const uint8_t ff_asv_ccp_tab[17][2]
This structure stores compressed data.
static void dct_get(ASVEncContext *a, const AVFrame *frame, int mb_x, int mb_y)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
The exact code depends on how similar the blocks are and how related they are to the block
static void put_bits_le(PutBitContext *s, int n, BitBuf value)
static void asv2_put_level(ASVEncContext *a, PutBitContext *pb, int level)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
const uint16_t ff_aanscales[64]