38 static int all_same(
char *bitmap,
int w,
int h)
65 return *bitmap || *(bitmap + 1) ||
72 return *bitmap == 0 &&
all_same(bitmap, w, h);
122 encode_block(bitmap + w + h * XFACE_WIDTH, w, h, level, pq);
152 int i, j, k,
ret = 0;
160 "Size value %dx%d not supported, only accepts a size of %dx%d\n",
169 buf = frame->
data[0];
172 for (k = 0; k < 8; k++)
173 xface->
bitmap[i++] = (buf[j]>>(7-k))&1;
static int all_white(char *bitmap, int w, int h)
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
const char const char void * val
static int all_same(char *bitmap, int w, int h)
This structure describes decoded (raw) audio or video data.
int max_line_len
max line length for compressed data
static av_cold int init(AVCodecContext *avctx)
static av_cold int xface_encode_close(AVCodecContext *avctx)
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
const ProbRange ff_xface_probranges_per_level[4][3]
X-Face common definitions.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static void encode_block(char *bitmap, int w, int h, int level, ProbRangesQueue *pq)
void ff_xface_generate_face(uint8_t *dst, uint8_t *const src)
static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
const char * name
Name of the codec implementation.
void ff_big_mul(BigInt *b, uint8_t a)
Multiply a by b storing the result in b.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int all_black(char *bitmap, int w, int h)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void push_greys(ProbRangesQueue *pq, char *bitmap, int w, int h)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void ff_big_add(BigInt *b, uint8_t a)
Add a to b storing the result in b.
const ProbRange ff_xface_probranges_2x2[16]
Libavcodec external API header.
int flags
A combination of AV_PKT_FLAG values.
static void push_integer(BigInt *b, const ProbRange *prange)
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
void ff_big_div(BigInt *b, uint8_t a, uint8_t *r)
Divide b by a storing the result in b and the remainder in the word pointed to by r...
uint8_t bitmap[XFACE_PIXELS]
image used internally for decoding
static av_cold int xface_encode_init(AVCodecContext *avctx)
#define XFACE_FIRST_PRINT
main external API structure.
static void close(AVCodecParserContext *s)
Describe the class of an AVClass context structure.
AVFrame * coded_frame
the picture in the bitstream
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
common internal api header.
const ProbRange * prob_ranges[XFACE_PIXELS *2]
static int pq_push(ProbRangesQueue *pq, const ProbRange *p)
int set_header
set X-Face header in the output
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.