42 const AVFrame *pict,
int *got_packet)
55 max_pkt_size += width * height * 3 * 4;
57 max_pkt_size += mb_width * mb_height * 3 * 4
61 av_log(avctx,
AV_LOG_ERROR,
"Error getting output packet of size %d.\n", max_pkt_size);
79 int left[3], top[3], topleft[3];
82 buffer[0][i]= 1 << (9 - 1);
85 for(y = 0; y <
height; y++) {
86 const int modified_predictor= y ? predictor : 1;
95 top[i]= left[i]= topleft[i]=
buffer[0][i];
97 for(x = 0; x <
width; x++) {
98 buffer[x][1] = ptr[4*x+0] - ptr[4*x+1] + 0x100;
99 buffer[x][2] = ptr[4*x+2] - ptr[4*x+1] + 0x100;
100 buffer[x][0] = (ptr[4*x+0] + 2*ptr[4*x+1] + ptr[4*x+2])>>2;
105 PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
112 diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
124 for(mb_y = 0; mb_y < mb_height; mb_y++) {
129 for(mb_x = 0; mb_x < mb_width; mb_x++) {
130 if(mb_x==0 || mb_y==0){
133 int x, y, h, v, linesize;
142 ptr = p->
data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
151 pred= ptr[-linesize];
153 PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
167 int x, y, h, v, linesize;
176 ptr = p->
data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
177 PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
This structure describes decoded (raw) audio or video data.
struct MpegEncContext MpegEncContext
MpegEncContext.
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
int ff_MPV_encode_end(AVCodecContext *avctx)
int mjpeg_hsample[3]
horizontal sampling factors, default = {2, 1, 1}
#define FF_MIN_BUFFER_SIZE
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
MJPEG encoder and decoder.
uint16_t huff_code_dc_chrominance[12]
Picture current_picture
copy of the current picture structure.
uint8_t huff_size_dc_chrominance[12]
static int init(AVCodecParserContext *s)
int ff_MPV_encode_init(AVCodecContext *avctx)
#define PREDICT(ret, topleft, top, left, predictor)
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int flags
A combination of AV_PKT_FLAG values.
static int put_bits_count(PutBitContext *s)
void ff_mjpeg_encode_picture_header(MpegEncContext *s)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
static const float pred[4]
struct MJpegContext * mjpeg_ctx
int mjpeg_vsample[3]
vertical sampling factors, default = {2, 1, 1}
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
int height
picture size. must be a multiple of 16
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
struct AVCodecContext * avctx
uint16_t huff_code_dc_luminance[12]
PutBitContext pb
bit output
uint8_t huff_size_dc_luminance[12]
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
int prediction_method
prediction method (needed for huffyuv)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
int key_frame
1 -> keyframe, 0-> not
void ff_mjpeg_encode_dc(MpegEncContext *s, int val, uint8_t *huff_size, uint16_t *huff_code)
This structure stores compressed data.