66 return *bitmap || *(bitmap + 1) ||
73 return *bitmap == 0 &&
all_same(bitmap, w, h);
123 encode_block(bitmap + w + h * XFACE_WIDTH, w, h, level, pq);
153 int i, j, k,
ret = 0;
161 "Size value %dx%d not supported, only accepts a size of %dx%d\n",
170 buf = frame->
data[0];
173 for (k = 0; k < 8; k++)
174 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
AVFrame * coded_frame
the picture in the bitstream
static av_cold int init(AVCodecContext *avctx)
static av_cold int xface_encode_close(AVCodecContext *avctx)
const ProbRange ff_xface_probranges_per_level[4][3]
X-Face common definitions.
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)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
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)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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.
simple assert() macros that are a bit more flexible than ISO C assert().
const ProbRange ff_xface_probranges_2x2[16]
const char * name
Name of the codec implementation.
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
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
Describe the class of an AVClass context structure.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
ProbRange prob_ranges[XFACE_PIXELS *2]
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
static int pq_push(ProbRangesQueue *pq, const ProbRange *p)
int set_header
set X-Face header in the output
AVPixelFormat
Pixel format.
This structure stores compressed data.