59 #define SKIP_PREFIX 0x8400 60 #define SKIPS_MAX 0x03FF 61 #define MKRGB555(in, off) (((in)[off] << 10) | ((in)[(off) + 1] << 5) | ((in)[(off) + 2])) 63 static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
66 const AVFrame *pict,
int *got_packet)
75 int i, j, k, x, y,
ret;
91 for(y = 0; y < avctx->
height; y += 4){
92 for(x = 0; x < avctx->
width; x += 4){
94 int bestscore = INT_MAX;
98 for(j = 0; j < 4; j++){
99 for(i = 0; i < 4; i++){
101 for(k = 0; k < 3; k++){
102 c->
block[(i + j*4)*3 + k] =
103 c->
block2[
remap[i + j*4]*3 + k] = (val >> (10-k*5)) & 0x1F;
109 for(j = 0; j < 4; j++){
110 for(i = 0; i < 4*3; i++){
111 int t = prevptr[x*3 + i - j*3*avctx->
width] - c->
block[i + j*4*3];
123 for(j = 0; j < 4; j++){
124 for(i = 0; i < 4; i++){
125 for(k = 0; k < 3; k++){
126 int t = c->
avg[k] - c->
block[(i+j*4)*3+k];
133 if(score < bestscore){
143 for(i = 0; i < 3; i++)
145 for(i = 0; i < 16; i++)
148 for(j = 0; j < 4; j++){
149 for(i = 0; i < 4; i++){
150 for(k = 0; k < 3; k++){
158 if(score < bestscore){
164 for(i = 0; i < 4; i++){
170 for(i = 0; i < 3; i++)
172 for(i = 12; i < 16; i++)
175 for(j = 0; j < 4; j++){
176 for(i = 0; i < 4; i++){
177 for(k = 0; k < 3; k++){
185 if(score < bestscore){
201 bytestream_put_le16(&dst,
MKRGB555(c->
avg,0) | 0x8000);
202 for(j = 0; j < 4; j++)
203 for(i = 0; i < 4; i++)
204 for(k = 0; k < 3; k++)
205 prevptr[x*3 + i*3 + k - j*3*avctx->
width] = c->
avg[k];
208 for(j = 0; j < 4; j++){
209 for(i = 0; i < 4; i++){
210 flags |= (c->
output[i + j*4]^1) << (i + j*4);
211 for(k = 0; k < 3; k++)
215 bytestream_put_le16(&dst, flags);
220 for(j = 0; j < 4; j++){
221 for(i = 0; i < 4; i++){
223 for(k = 0; k < 3; k++)
227 bytestream_put_le16(&dst, flags);
229 for(i = 3; i < 24; i += 3)
235 prevptr -= avctx->
width * 3 * 4;
240 bytestream_put_byte(&dst, 0);
241 bytestream_put_byte(&dst, 0);
250 pkt->
size = dst - buf;
static av_cold int encode_init(AVCodecContext *avctx)
init encoder
Context structure for the Lagged Fibonacci PRNG.
This structure describes decoded (raw) audio or video data.
static av_cold int init(AVCodecContext *avctx)
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
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 avpriv_do_elbg(int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
Implementation of the Enhanced LBG Algorithm Based on the paper "Neural Networks 14:1219-1237" that c...
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_INPUT_BUFFER_MIN_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
int flags
A combination of AV_PKT_FLAG values.
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 width
picture width / height.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
int avpriv_init_elbg(int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
Initialize the **codebook vector for the elbg algorithm.
Libavcodec external API header.
static const int remap[16]
static av_cold int encode_end(AVCodecContext *avctx)
Uninit encoder.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
AVCodec ff_msvideo1_encoder
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static enum AVPixelFormat pix_fmts[]
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
#define AV_PIX_FMT_RGB555
#define MKRGB555(in, off)
#define FFSWAP(type, a, b)
AVPixelFormat
Pixel format.
static double val(void *priv, double ch)
This structure stores compressed data.
int keyint_min
minimum GOP size