192 size = strlen(
"CS=ITU601")+3;
284 int align= (-(size_t)(buf))&3;
286 assert((size&7) == 0);
290 for(i=0; i<size && i<align; i++){
291 if(buf[i]==0xFF) ff_count++;
293 for(; i<size-15; i+=16){
296 v= *(uint32_t*)(&buf[i]);
297 acc= (((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
298 v= *(uint32_t*)(&buf[i+4]);
299 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
300 v= *(uint32_t*)(&buf[i+8]);
301 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
302 v= *(uint32_t*)(&buf[i+12]);
303 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
311 if(buf[i]==0xFF) ff_count++;
314 if(ff_count==0)
return;
319 for(i=size-1; ff_count; i--){
335 if(length)
put_bits(pbc, length, (1<<length)-1);
351 uint8_t *huff_size, uint16_t *huff_code)
366 put_bits(&s->
pb, huff_size[nbits], huff_code[nbits]);
374 int mant, nbits, code, i, j;
375 int component, dc,
run, last_index, val;
378 uint16_t *huff_code_ac;
381 component = (n <= 3 ? 0 : (n&1) + 1);
383 val = dc - s->
last_dc[component];
399 for(i=1;i<=last_index;i++) {
406 put_bits(&s->
pb, huff_size_ac[0xf0], huff_code_ac[0xf0]);
416 code = (run << 4) | nbits;
418 put_bits(&s->
pb, huff_size_ac[code], huff_code_ac[code]);
426 if (last_index < 63 || run != 0)
427 put_bits(&s->
pb, huff_size_ac[0], huff_code_ac[0]);
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define CODEC_FLAG_BITEXACT
struct MpegEncContext MpegEncContext
MpegEncContext.
static void put_sbits(PutBitContext *pb, int n, int32_t value)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
const uint8_t avpriv_mjpeg_bits_ac_luminance[17]
uint16_t chroma_intra_matrix[64]
int ff_MPV_encode_end(AVCodecContext *avctx)
int mjpeg_hsample[3]
horizontal sampling factors, default = {2, 1, 1}
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int min_qcoeff
minimum encodable coefficient
const uint8_t avpriv_mjpeg_bits_dc_chrominance[17]
const uint8_t avpriv_mjpeg_bits_ac_chrominance[17]
av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
MJPEG encoder and decoder.
uint16_t huff_code_dc_chrominance[12]
uint16_t huff_code_ac_luminance[256]
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, const uint8_t *bits_table, const uint8_t *val_table)
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
uint8_t huff_size_dc_chrominance[12]
int max_qcoeff
maximum encodable coefficient
static int init(AVCodecParserContext *s)
int ff_MPV_encode_init(AVCodecContext *avctx)
static int get_bits_diff(MpegEncContext *s)
uint16_t huff_code_ac_chrominance[256]
uint8_t huff_size_ac_luminance[256]
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int last_dc[3]
last DC values for MPEG1
#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...
uint8_t huff_size_ac_chrominance[256]
const char * name
Name of the codec implementation.
static void put_bits(PutBitContext *s, int n, unsigned int value)
Write up to 31 bits into a bitstream.
static int put_bits_count(PutBitContext *s)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
void ff_mjpeg_encode_picture_header(MpegEncContext *s)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
static void jpeg_put_comments(MpegEncContext *s)
void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64])
const uint8_t avpriv_mjpeg_bits_dc_luminance[17]
const uint8_t avpriv_mjpeg_val_dc[12]
int block_last_index[12]
last non zero coefficient in block
struct MJpegContext * mjpeg_ctx
int mjpeg_vsample[3]
vertical sampling factors, default = {2, 1, 1}
void ff_mjpeg_encode_close(MpegEncContext *s)
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
void ff_mjpeg_encode_stuffing(PutBitContext *pbc)
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
static void jpeg_table_header(MpegEncContext *s)
int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
static int put_huffman_table(MpegEncContext *s, int table_class, int table_id, const uint8_t *bits_table, const uint8_t *value_table)
const uint8_t avpriv_mjpeg_val_ac_luminance[]
struct AVCodecContext * avctx
uint16_t huff_code_dc_luminance[12]
PutBitContext pb
bit output
uint8_t huff_size_dc_luminance[12]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
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 put_marker(PutBitContext *p, int code)
const uint8_t avpriv_mjpeg_val_ac_chrominance[]
void ff_mjpeg_encode_dc(MpegEncContext *s, int val, uint8_t *huff_size, uint16_t *huff_code)
void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string)
Put the string string in the bitstream.
int flags
AVCodecContext.flags (HQ, MV4, ...)
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
static void escape_FF(MpegEncContext *s, int start)
AVPixelFormat
Pixel format.