Go to the documentation of this file.
61 #define SKIP_PREFIX 0x8400
62 #define SKIPS_MAX 0x03FF
63 #define MKRGB555(in, off) (((in)[off] << 10) | ((in)[(off) + 1] << 5) | ((in)[(off) + 2]))
65 static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
68 const AVFrame *pict,
int *got_packet)
77 int i, j, k, x, y,
ret;
95 for(y = 0; y < avctx->
height; y += 4){
96 for(x = 0; x < avctx->
width; x += 4){
98 int bestscore = INT_MAX;
102 for(j = 0; j < 4; j++){
103 for(
i = 0;
i < 4;
i++){
105 for(k = 0; k < 3; k++){
106 c->block[(
i + j*4)*3 + k] =
107 c->block2[
remap[
i + j*4]*3 + k] = (
val >> (10-k*5)) & 0x1F;
113 for(j = 0; j < 4; j++){
114 for(
i = 0;
i < 4*3;
i++){
115 int t = prevptr[x*3 +
i - j*3*avctx->
width] -
c->block[
i + j*4*3];
124 1, 1,
c->output, &
c->rnd, 0);
129 for(j = 0; j < 4; j++){
130 for(
i = 0;
i < 4;
i++){
131 for(k = 0; k < 3; k++){
132 int t =
c->avg[k] -
c->block[(
i+j*4)*3+k];
139 if(score < bestscore){
146 2, 1,
c->output, &
c->rnd, 0);
151 for(
i = 0;
i < 3;
i++)
152 FFSWAP(uint8_t,
c->codebook[
i],
c->codebook[
i+3]);
153 for(
i = 0;
i < 16;
i++)
156 for(j = 0; j < 4; j++){
157 for(
i = 0;
i < 4;
i++){
158 for(k = 0; k < 3; k++){
159 int t =
c->codebook[
c->output[
i+j*4]*3 + k] -
c->block[
i*3+k+j*4*3];
166 if(score < bestscore){
172 for(
i = 0;
i < 4;
i++){
174 c->codebook2 +
i * 2 * 3, 2, 1,
175 c->output2 +
i * 4, &
c->rnd, 0);
181 for(
i = 0;
i < 3;
i++)
182 FFSWAP(uint8_t,
c->codebook2[
i+18],
c->codebook2[
i+21]);
183 for(
i = 12;
i < 16;
i++)
186 for(j = 0; j < 4; j++){
187 for(
i = 0;
i < 4;
i++){
188 for(k = 0; k < 3; k++){
189 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];
196 if(score < bestscore){
212 bytestream_put_le16(&dst,
MKRGB555(
c->avg,0) | 0x8000);
213 for(j = 0; j < 4; j++)
214 for(
i = 0;
i < 4;
i++)
215 for(k = 0; k < 3; k++)
216 prevptr[x*3 +
i*3 + k - j*3*avctx->
width] =
c->avg[k];
219 for(j = 0; j < 4; j++){
220 for(
i = 0;
i < 4;
i++){
221 flags |= (
c->output[
i + j*4]^1) << (
i + j*4);
222 for(k = 0; k < 3; k++)
223 prevptr[x*3 +
i*3 + k - j*3*avctx->
width] =
c->codebook[
c->output[
i + j*4]*3 + k];
226 bytestream_put_le16(&dst,
flags);
227 bytestream_put_le16(&dst,
MKRGB555(
c->codebook, 0));
228 bytestream_put_le16(&dst,
MKRGB555(
c->codebook, 3));
231 for(j = 0; j < 4; j++){
232 for(
i = 0;
i < 4;
i++){
234 for(k = 0; k < 3; k++)
235 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];
238 bytestream_put_le16(&dst,
flags);
239 bytestream_put_le16(&dst,
MKRGB555(
c->codebook2, 0) | 0x8000);
240 for(
i = 3;
i < 24;
i += 3)
241 bytestream_put_le16(&dst,
MKRGB555(
c->codebook2,
i));
246 prevptr -= avctx->
width * 3 * 4;
251 bytestream_put_byte(&dst, 0);
252 bytestream_put_byte(&dst, 0);
308 .
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.
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.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_INPUT_BUFFER_MIN_SIZE
#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.
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.