Go to the documentation of this file.
62 #define SKIP_PREFIX 0x8400
63 #define SKIPS_MAX 0x03FF
64 #define MKRGB555(in, off) (((in)[off] << 10) | ((in)[(off) + 1] << 5) | ((in)[(off) + 2]))
66 static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
69 const AVFrame *pict,
int *got_packet)
78 int i, j, k, x, y,
ret;
96 for(y = 0; y < avctx->
height; y += 4){
97 for(x = 0; x < avctx->
width; x += 4){
99 int bestscore = INT_MAX;
103 for(j = 0; j < 4; j++){
104 for(
i = 0;
i < 4;
i++){
106 for(k = 0; k < 3; k++){
107 c->block[(
i + j*4)*3 + k] =
108 c->block2[
remap[
i + j*4]*3 + k] = (
val >> (10-k*5)) & 0x1F;
114 for(j = 0; j < 4; j++){
115 for(
i = 0;
i < 4*3;
i++){
116 int t = prevptr[x*3 +
i - j*3*avctx->
width] -
c->block[
i + j*4*3];
125 1, 1,
c->output, &
c->rnd, 0);
130 for(j = 0; j < 4; j++){
131 for(
i = 0;
i < 4;
i++){
132 for(k = 0; k < 3; k++){
133 int t =
c->avg[k] -
c->block[(
i+j*4)*3+k];
140 if(score < bestscore){
147 2, 1,
c->output, &
c->rnd, 0);
152 for(
i = 0;
i < 3;
i++)
153 FFSWAP(uint8_t,
c->codebook[
i],
c->codebook[
i+3]);
154 for(
i = 0;
i < 16;
i++)
157 for(j = 0; j < 4; j++){
158 for(
i = 0;
i < 4;
i++){
159 for(k = 0; k < 3; k++){
160 int t =
c->codebook[
c->output[
i+j*4]*3 + k] -
c->block[
i*3+k+j*4*3];
167 if(score < bestscore){
173 for(
i = 0;
i < 4;
i++){
175 c->codebook2 +
i * 2 * 3, 2, 1,
176 c->output2 +
i * 4, &
c->rnd, 0);
182 for(
i = 0;
i < 3;
i++)
183 FFSWAP(uint8_t,
c->codebook2[
i+18],
c->codebook2[
i+21]);
184 for(
i = 12;
i < 16;
i++)
187 for(j = 0; j < 4; j++){
188 for(
i = 0;
i < 4;
i++){
189 for(k = 0; k < 3; k++){
190 int t =
c->codebook2[(
c->output2[
remap[
i+j*4]] + (
i&2) + (j&2)*2)*3+k] -
c->block[
i*3+k + j*4*3];
197 if(score < bestscore){
214 for(j = 0; j < 4; j++)
215 for(
i = 0;
i < 4;
i++)
216 for(k = 0; k < 3; k++)
217 prevptr[x*3 +
i*3 + k - j*3*avctx->
width] =
c->avg[k];
220 for(j = 0; j < 4; j++){
221 for(
i = 0;
i < 4;
i++){
222 flags |= (
c->output[
i + j*4]^1) << (
i + j*4);
223 for(k = 0; k < 3; k++)
224 prevptr[x*3 +
i*3 + k - j*3*avctx->
width] =
c->codebook[
c->output[
i + j*4]*3 + k];
232 for(j = 0; j < 4; j++){
233 for(
i = 0;
i < 4;
i++){
235 for(k = 0; k < 3; k++)
236 prevptr[x*3 +
i*3 + k - j*3*avctx->
width] =
c->codebook2[(
c->output2[
remap[
i+j*4]] + (
i&2) + (j&2)*2)*3 + k];
240 bytestream_put_le16(&
dst,
MKRGB555(
c->codebook2, 0) | 0x8000);
241 for(
i = 3;
i < 24;
i += 3)
247 prevptr -= avctx->
width * 3 * 4;
252 bytestream_put_byte(&
dst, 0);
253 bytestream_put_byte(&
dst, 0);
309 .
p.
name =
"msvideo1",
AVPixelFormat
Pixel format.
int keyint_min
minimum GOP size
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
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
This structure describes decoded (raw) audio or video data.
const FFCodec ff_msvideo1_encoder
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define FF_INPUT_BUFFER_MIN_SIZE
Used by some encoders as upper bound for the length of headers.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVCodec p
The public AVCodec.
static double val(void *priv, double ch)
#define FF_CODEC_ENCODE_CB(func)
int avpriv_elbg_do(ELBGContext **elbgp, int *points, int dim, int numpoints, int *codebook, int num_cb, int max_steps, int *closest_cb, AVLFG *rand_state, uintptr_t flags)
Implementation of the Enhanced LBG Algorithm Based on the paper "Neural Networks 14:1219-1237" that c...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define CODEC_LONG_NAME(str)
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
Context structure for the Lagged Fibonacci PRNG.
int(* init)(AVBSFContext *ctx)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
av_cold void avpriv_elbg_free(ELBGContext **elbgp)
Free an ELBGContext and reset the pointer to it.
static const int remap[16]
int flags
A combination of AV_PKT_FLAG values.
static av_cold int encode_end(AVCodecContext *avctx)
Uninit encoder.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_RGB555
const char * name
Name of the codec implementation.
#define FFSWAP(type, a, b)
static av_cold int encode_init(AVCodecContext *avctx)
init encoder
main external API structure.
struct ELBGContext * elbg
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
#define MKRGB555(in, off)
This structure stores compressed data.
int width
picture width / height.
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.