106 uint16_t luma_intra_matrix[64],
107 uint16_t chroma_intra_matrix[64],
114 int matrix_count = 1 + !!memcmp(luma_intra_matrix,
116 sizeof(luma_intra_matrix[0]) * 64);
119 put_bits(p, 16, 2 + matrix_count * (1 + 64));
124 put_bits(p, 8, luma_intra_matrix[j]);
127 if (matrix_count > 1) {
132 put_bits(p, 8, chroma_intra_matrix[j]);
198 size = strlen(
"CS=ITU601")+3;
205 int chroma_h_shift, chroma_v_shift;
213 vsample[0] = hsample[0] =
214 vsample[1] = hsample[1] =
215 vsample[2] = hsample[2] = 1;
217 vsample[0] = vsample[1] = vsample[2] = 2;
218 hsample[0] = hsample[1] = hsample[2] = 1;
221 vsample[1] = 2 >> chroma_v_shift;
222 vsample[2] = 2 >> chroma_v_shift;
224 hsample[1] = 2 >> chroma_h_shift;
225 hsample[2] = 2 >> chroma_h_shift;
231 uint16_t luma_intra_matrix[64],
232 uint16_t chroma_intra_matrix[64])
235 int hsample[3], vsample[3];
237 int chroma_matrix = !!memcmp(luma_intra_matrix,
239 sizeof(luma_intra_matrix[0])*64);
250 jpeg_table_header(avctx, pb, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample);
279 put_bits(pb, 8, lossless ? 0 : chroma_matrix);
285 put_bits(pb, 8, lossless ? 0 : chroma_matrix);
333 int align= (-(size_t)(buf))&3;
346 for(i=0; i<size && i<
align; i++){
347 if(buf[i]==0xFF) ff_count++;
349 for(; i<size-15; i+=16){
352 v= *(uint32_t*)(&buf[i]);
353 acc= (((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
354 v= *(uint32_t*)(&buf[i+4]);
355 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
356 v= *(uint32_t*)(&buf[i+8]);
357 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
358 v= *(uint32_t*)(&buf[i+12]);
359 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
367 if(buf[i]==0xFF) ff_count++;
370 if(ff_count==0)
return;
375 for(i=size-1; ff_count; i--){
411 uint8_t *huff_size, uint16_t *huff_code)
416 put_bits(pb, huff_size[0], huff_code[0]);
426 put_bits(pb, huff_size[nbits], huff_code[nbits]);
434 int mant, nbits, code, i, j;
435 int component,
dc,
run, last_index,
val;
438 uint16_t *huff_code_ac;
441 component = (n <= 3 ? 0 : (n&1) + 1);
443 val = dc - s->
last_dc[component];
459 for(i=1;i<=last_index;i++) {
466 put_bits(&s->
pb, huff_size_ac[0xf0], huff_code_ac[0xf0]);
476 code = (run << 4) | nbits;
478 put_bits(&s->
pb, huff_size_ac[code], huff_code_ac[code]);
486 if (last_index < 63 || run != 0)
487 put_bits(&s->
pb, huff_size_ac[0], huff_code_ac[0]);
528 const AVFrame *pic_arg,
int *got_packet)
534 int chroma_h_shift, chroma_v_shift;
546 for(i=0; i < 3; i++) {
547 int vsample = i ? 2 >> chroma_v_shift : 2;
556 #if CONFIG_MJPEG_ENCODER
572 #if CONFIG_AMV_ENCODER