59 uint16_t luma_intra_matrix[64],
60 uint16_t chroma_intra_matrix[64],
67 int matrix_count = 1 + !!memcmp(luma_intra_matrix,
69 sizeof(luma_intra_matrix[0]) * 64);
72 put_bits(p, 16, 2 + matrix_count * (1 + 64));
77 put_bits(p, 8, luma_intra_matrix[j]);
80 if (matrix_count > 1) {
85 put_bits(p, 8, chroma_intra_matrix[j]);
151 size = strlen(
"CS=ITU601")+3;
158 int chroma_h_shift, chroma_v_shift;
166 vsample[0] = hsample[0] =
167 vsample[1] = hsample[1] =
168 vsample[2] = hsample[2] = 1;
170 vsample[0] = vsample[1] = vsample[2] = 2;
171 hsample[0] = hsample[1] = hsample[2] = 1;
174 vsample[1] = 2 >> chroma_v_shift;
175 vsample[2] = 2 >> chroma_v_shift;
177 hsample[1] = 2 >> chroma_h_shift;
178 hsample[2] = 2 >> chroma_h_shift;
184 uint16_t luma_intra_matrix[64],
185 uint16_t chroma_intra_matrix[64])
188 int hsample[3], vsample[3];
190 int chroma_matrix = !!memcmp(luma_intra_matrix,
192 sizeof(luma_intra_matrix[0])*64);
203 jpeg_table_header(avctx, pb, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample);
232 put_bits(pb, 8, lossless ? 0 : chroma_matrix);
238 put_bits(pb, 8, lossless ? 0 : chroma_matrix);
286 int align= (-(size_t)(buf))&3;
299 for(i=0; i<size && i<
align; i++){
300 if(buf[i]==0xFF) ff_count++;
302 for(; i<size-15; i+=16){
305 v= *(uint32_t*)(&buf[i]);
306 acc= (((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
307 v= *(uint32_t*)(&buf[i+4]);
308 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
309 v= *(uint32_t*)(&buf[i+8]);
310 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
311 v= *(uint32_t*)(&buf[i+12]);
312 acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
320 if(buf[i]==0xFF) ff_count++;
323 if(ff_count==0)
return;
328 for(i=size-1; ff_count; i--){
364 uint8_t *huff_size, uint16_t *huff_code)
369 put_bits(pb, huff_size[0], huff_code[0]);
379 put_bits(pb, huff_size[nbits], huff_code[nbits]);