63 int left[3], top[3], topleft[3];
66 buffer[0][i]= 1 << (9 - 1);
69 for(y = 0; y <
height; y++) {
70 const int modified_predictor= y ? predictor : 1;
71 uint8_t *ptr = p->
data[0] + (linesize * y);
79 top[i]= left[i]= topleft[i]=
buffer[0][i];
81 for(x = 0; x <
width; x++) {
82 buffer[x][1] = ptr[4*x+0] - ptr[4*x+1] + 0x100;
83 buffer[x][2] = ptr[4*x+2] - ptr[4*x+1] + 0x100;
84 buffer[x][0] = (ptr[4*x+0] + 2*ptr[4*x+1] + ptr[4*x+2])>>2;
89 PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
96 diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
110 for(mb_y = 0; mb_y < mb_height; mb_y++) {
115 for(mb_x = 0; mb_x < mb_width; mb_x++) {
116 if(mb_x==0 || mb_y==0){
119 int x, y, h,
v, linesize;
128 ptr = p->
data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
137 pred= ptr[-linesize];
139 PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
153 int x, y, h,
v, linesize;
162 ptr = p->
data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
164 PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
struct MpegEncContext MpegEncContext
MpegEncContext.
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
int MPV_encode_init(AVCodecContext *avctx)
int mjpeg_hsample[3]
horizontal sampling factors, default = {2, 1, 1}
static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
MJPEG encoder and decoder.
uint16_t huff_code_dc_chrominance[12]
Picture current_picture
copy of the current picture structure.
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
uint8_t huff_size_dc_chrominance[12]
static int init(AVCodecParserContext *s)
#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.
int MPV_encode_end(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static int put_bits_count(PutBitContext *s)
static av_always_inline void emms_c(void)
Empty mmx state.
void ff_mjpeg_encode_picture_header(MpegEncContext *s)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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]
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)