Go to the documentation of this file.
28 #define VECTOR_VLC_BITS 6
31 2, 4, 4, 4, 4, 2, 4, 4,
32 6, 6, 6, 6, 6, 6, 6, 6
74 if (avctx->
width & 15)
105 return x >= 1 && x <= 5 ? 1 << x : 0;
110 return x >= 1 && x <= 4 ? 1 << x : 1;
125 int book1 = -256 *
seed[3];
126 int book2 = -128 *
seed[4];
127 int book3 = -128 *
seed[5];
128 int book4 = -128 *
seed[6];
130 for (
int i = -128;
i < 128;
i++) {
131 s->codebook[0][(uint8_t)
i] = book1;
132 s->codebook[1][(uint8_t)
i] =
bias(book2,
seed[0]);
133 s->codebook[2][(uint8_t)
i] =
bias(book3,
seed[1]);
134 s->codebook[3][(uint8_t)
i] =
bias(book4,
seed[2]);
136 book1 += 2 *
seed[3];
146 uint8_t * vectors =
s->vectors;
147 uint8_t * vectors_end =
s->vectors + (
width *
height * 3) / 2;
154 uint8_t * dst = vectors;
161 if (dst >= vectors_end - 1)
176 case SKIP_3: dst += 3;
break;
177 case SKIP_4: dst += 4;
break;
178 case SKIP_5: dst += 5;
break;
179 case SKIP_6: dst += 6;
break;
196 int16_t * c0 =
s->coeff;
197 int16_t *
c1 =
s->coeff + coeff_width;
198 int16_t * c0_125 =
s->coeff + (coeff_width >> 3);
199 int16_t * c1_125 =
s->coeff + coeff_width + (coeff_width >> 3);
200 int16_t * c0_25 =
s->coeff + (coeff_width >> 2);
201 int16_t * c1_25 =
s->coeff + coeff_width + (coeff_width >> 2);
202 int16_t * c0_5 =
s->coeff + (coeff_width >> 1);
203 int16_t * c1_5 =
s->coeff + coeff_width + (coeff_width >> 1);
206 c0[0] =
s->codebook[0][v[0]];
207 c0[1] =
s->codebook[0][v[1]];
210 c1[0] =
s->codebook[0][v[2]];
211 c1[1] =
s->codebook[0][v[3]];
214 c0_125[0] =
s->codebook[1][v[4]];
215 c0_125[1] =
s->codebook[1][v[5]];
218 c1_125[0] =
s->codebook[1][v[6]];
219 c1_125[1] =
s->codebook[1][v[7]];
222 c0_25[0] =
s->codebook[2][v[8]];
223 c0_25[1] =
s->codebook[2][v[9]];
224 c0_25[2] =
s->codebook[2][v[10]];
225 c0_25[3] =
s->codebook[2][v[11]];
228 c1_25[0] =
s->codebook[2][v[12]];
229 c1_25[1] =
s->codebook[2][v[13]];
230 c1_25[2] =
s->codebook[2][v[14]];
231 c1_25[3] =
s->codebook[2][v[15]];
234 if (v[16] | v[17] | v[18] | v[19]) {
235 c0_5[0] =
s->codebook[3][v[16]];
236 c0_5[1] =
s->codebook[3][v[17]];
237 c0_5[2] =
s->codebook[3][v[18]];
238 c0_5[3] =
s->codebook[3][v[19]];
240 c0_5[0] = c0_5[1] = c0_5[2] = c0_5[3] = 0;
243 if (v[20] | v[21] | v[22] | v[23]) {
244 c0_5[4] =
s->codebook[3][v[20]];
245 c0_5[5] =
s->codebook[3][v[21]];
246 c0_5[6] =
s->codebook[3][v[22]];
247 c0_5[7] =
s->codebook[3][v[23]];
249 c0_5[4] = c0_5[5] = c0_5[6] = c0_5[7] = 0;
253 if (v[24] | v[25] | v[26] | v[27]) {
254 c1_5[0] =
s->codebook[3][v[24]];
255 c1_5[1] =
s->codebook[3][v[25]];
256 c1_5[2] =
s->codebook[3][v[26]];
257 c1_5[3] =
s->codebook[3][v[27]];
259 c1_5[0] = c1_5[1] = c1_5[2] = c1_5[3] = 0;
262 if (v[28] | v[29] | v[30] | v[31]) {
263 c1_5[4] =
s->codebook[3][v[28]];
264 c1_5[5] =
s->codebook[3][v[29]];
265 c1_5[6] =
s->codebook[3][v[30]];
266 c1_5[7] =
s->codebook[3][v[31]];
268 c1_5[4] = c1_5[5] = c1_5[6] = c1_5[7] = 0;
278 int s0 =
a[0] + (
b[0] >> 1);
280 for (
int i = 0;
i <
width / 2 - 1;
i++) {
282 s0 =
a[
i + 1] + ((
b[
i] +
b[
i + 1]) >> 1);
283 dst[
i * 2 + 1] = ((dst[
i * 2] +
s0) >> 1) - 2 *
b[
i];
292 return x >= -128 ? x <= 127 ? x + 0x80 : 0x00 : 0xFF;
297 int s0 =
a[0] + (
b[0] >> 1);
300 for (
int i = 0;
i <
width / 2 - 1;
i++) {
302 tmp =
a[
i + 1] + ((
b[
i] +
b[
i + 1]) >> 1);
313 const int16_t *
coeff;
316 int v0 =
s->coeff[
i];
318 s->coeff[
i] =
v0 - v1;
338 uint8_t * vectors =
s->vectors;
339 uint8_t * y =
s->frame->data[0];
340 uint8_t *
u =
s->frame->data[1];
341 uint8_t * v =
s->frame->data[2];
343 for (
int j = 0; j <
height / 4; j++) {
346 vectors += 2 *
width;
347 y += 2 *
s->frame->linesize[0];
352 u += 2 *
s->frame->linesize[1];
356 vectors += 2 *
width;
357 y += 2 *
s->frame->linesize[0];
362 v += 2 *
s->frame->linesize[2];
371 const uint8_t * buf = avpkt->
data;
372 int cache,
seed[7], gamma, contrast;
382 if (((buf[0] >> 1) & 7) != 5) {
397 contrast =
AV_RL16(buf + 2) >> 1;
398 if (gamma || contrast)
#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 seed_codebooks(VqcContext *s, const int *seed)
#define u(width, name, range_min, range_max)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static av_cold int vqc_decode_end(AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
const FFCodec ff_vqc_decoder
static void load_coeffs(VqcContext *s, const uint8_t *v, int width, int coeff_width)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
static void transform2(const int16_t *a, const int16_t *b, uint8_t *dst, int width)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int ff_thread_once(char *control, void(*routine)(void))
#define FF_ARRAY_ELEMS(a)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define FF_CODEC_DECODE_CB(func)
static const uint8_t vector_nbits[]
static int seed_pow2(int x)
int(* init)(AVBSFContext *ctx)
static int get_sbits(GetBitContext *s, int n)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void decode_strip(VqcContext *s, uint8_t *dst, int stride, int width)
#define CODEC_LONG_NAME(str)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int bias(int x, int c)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
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
static av_cold int vqc_decode_init(AVCodecContext *avctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static int seed_pow1(int x)
static void transform1(const int16_t *a, const int16_t *b, int16_t *dst, int width)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
static const int8_t vector_symbols[]
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
static uint8_t clip(int x)
static void decode_frame(VqcContext *s, int width, int height)
#define i(width, name, range_min, range_max)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define av_malloc_array(a, b)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int decode_vectors(VqcContext *s, const uint8_t *buf, int size, int width, int height)
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
static int vqc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
main external API structure.
#define VLC_INIT_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, symbols, symbols_wrap, symbols_size, offset, flags, static_size)
#define avpriv_request_sample(...)
This structure stores compressed data.
int width
picture width / height.
static const double coeff[2][5]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_cold void vqc_init_static_data(void)