FFmpeg
mjpegenc_common.c
Go to the documentation of this file.
1 /*
2  * lossless JPEG shared bits
3  * Copyright (c) 2000, 2001 Fabrice Bellard
4  * Copyright (c) 2003 Alex Beregszaszi
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <stdint.h>
24 #include <string.h>
25 
26 #include "libavutil/pixdesc.h"
27 #include "libavutil/pixfmt.h"
28 
29 #include "avcodec.h"
30 #include "idctdsp.h"
31 #include "jpegtables.h"
32 #include "put_bits.h"
33 #include "mjpegenc.h"
34 #include "mjpegenc_common.h"
35 #include "mjpeg.h"
36 
37 /* table_class: 0 = DC coef, 1 = AC coefs */
38 static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
39  const uint8_t *bits_table, const uint8_t *value_table)
40 {
41  int n, i;
42 
43  put_bits(p, 4, table_class);
44  put_bits(p, 4, table_id);
45 
46  n = 0;
47  for(i=1;i<=16;i++) {
48  n += bits_table[i];
49  put_bits(p, 8, bits_table[i]);
50  }
51 
52  for(i=0;i<n;i++)
53  put_bits(p, 8, value_table[i]);
54 
55  return n + 17;
56 }
57 
59  ScanTable *intra_scantable,
60  uint16_t luma_intra_matrix[64],
61  uint16_t chroma_intra_matrix[64],
62  int hsample[3])
63 {
64  int i, j, size;
65  uint8_t *ptr;
67 
68  /* Since avctx->priv_data will point to LJpegEncContext in this case */
69  if (avctx->codec_id != AV_CODEC_ID_LJPEG)
70  s = avctx->priv_data;
71 
72  if (avctx->codec_id != AV_CODEC_ID_LJPEG) {
73  int matrix_count = 1 + !!memcmp(luma_intra_matrix,
74  chroma_intra_matrix,
75  sizeof(luma_intra_matrix[0]) * 64);
76  if (s && s->force_duplicated_matrix)
77  matrix_count = 2;
78  /* quant matrixes */
79  put_marker(p, DQT);
80  put_bits(p, 16, 2 + matrix_count * (1 + 64));
81  put_bits(p, 4, 0); /* 8 bit precision */
82  put_bits(p, 4, 0); /* table 0 */
83  for(i=0;i<64;i++) {
84  j = intra_scantable->permutated[i];
85  put_bits(p, 8, luma_intra_matrix[j]);
86  }
87 
88  if (matrix_count > 1) {
89  put_bits(p, 4, 0); /* 8 bit precision */
90  put_bits(p, 4, 1); /* table 1 */
91  for(i=0;i<64;i++) {
92  j = intra_scantable->permutated[i];
93  put_bits(p, 8, chroma_intra_matrix[j]);
94  }
95  }
96  }
97 
99  put_marker(p, DRI);
100  put_bits(p, 16, 4);
101  put_bits(p, 16, (avctx->width-1)/(8*hsample[0]) + 1);
102  }
103 
104  /* huffman table */
105  put_marker(p, DHT);
106  flush_put_bits(p);
107  ptr = put_bits_ptr(p);
108  put_bits(p, 16, 0); /* patched later */
109  size = 2;
110 
111  // Only MJPEG can have a variable Huffman variable. All other
112  // formats use the default Huffman table.
113  if (s && s->huffman == HUFFMAN_TABLE_OPTIMAL) {
114  size += put_huffman_table(p, 0, 0, s->mjpeg_ctx->bits_dc_luminance,
115  s->mjpeg_ctx->val_dc_luminance);
116  size += put_huffman_table(p, 0, 1, s->mjpeg_ctx->bits_dc_chrominance,
117  s->mjpeg_ctx->val_dc_chrominance);
118 
119  size += put_huffman_table(p, 1, 0, s->mjpeg_ctx->bits_ac_luminance,
120  s->mjpeg_ctx->val_ac_luminance);
121  size += put_huffman_table(p, 1, 1, s->mjpeg_ctx->bits_ac_chrominance,
122  s->mjpeg_ctx->val_ac_chrominance);
123  } else {
128 
133  }
134  AV_WB16(ptr, size);
135 }
136 
138 {
139  int size;
140  uint8_t *ptr;
141 
142  if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
143  AVRational sar = avctx->sample_aspect_ratio;
144 
145  if (sar.num > 65535 || sar.den > 65535) {
146  if (!av_reduce(&sar.num, &sar.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 65535))
147  av_log(avctx, AV_LOG_WARNING,
148  "Cannot store exact aspect ratio %d:%d\n",
149  avctx->sample_aspect_ratio.num,
150  avctx->sample_aspect_ratio.den);
151  }
152 
153  /* JFIF header */
154  put_marker(p, APP0);
155  put_bits(p, 16, 16);
156  ff_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
157  /* The most significant byte is used for major revisions, the least
158  * significant byte for minor revisions. Version 1.02 is the current
159  * released revision. */
160  put_bits(p, 16, 0x0102);
161  put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
162  put_bits(p, 16, sar.num);
163  put_bits(p, 16, sar.den);
164  put_bits(p, 8, 0); /* thumbnail width */
165  put_bits(p, 8, 0); /* thumbnail height */
166  }
167 
168  /* comment */
169  if (!(avctx->flags & AV_CODEC_FLAG_BITEXACT)) {
170  put_marker(p, COM);
171  flush_put_bits(p);
172  ptr = put_bits_ptr(p);
173  put_bits(p, 16, 0); /* patched later */
175  size = strlen(LIBAVCODEC_IDENT)+3;
176  AV_WB16(ptr, size);
177  }
178 
179  if (((avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
180  avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
181  avctx->pix_fmt == AV_PIX_FMT_YUV444P) && avctx->color_range != AVCOL_RANGE_JPEG)
182  || avctx->color_range == AVCOL_RANGE_MPEG) {
183  put_marker(p, COM);
184  flush_put_bits(p);
185  ptr = put_bits_ptr(p);
186  put_bits(p, 16, 0); /* patched later */
187  ff_put_string(p, "CS=ITU601", 1);
188  size = strlen("CS=ITU601")+3;
189  AV_WB16(ptr, size);
190  }
191 }
192 
193 void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4])
194 {
195  int chroma_h_shift, chroma_v_shift;
196 
197  av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift,
198  &chroma_v_shift);
199  if (avctx->codec->id == AV_CODEC_ID_LJPEG &&
200  ( avctx->pix_fmt == AV_PIX_FMT_BGR0
201  || avctx->pix_fmt == AV_PIX_FMT_BGRA
202  || avctx->pix_fmt == AV_PIX_FMT_BGR24)) {
203  vsample[0] = hsample[0] =
204  vsample[1] = hsample[1] =
205  vsample[2] = hsample[2] =
206  vsample[3] = hsample[3] = 1;
207  } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P) {
208  vsample[0] = vsample[1] = vsample[2] = 2;
209  hsample[0] = hsample[1] = hsample[2] = 1;
210  } else {
211  vsample[0] = 2;
212  vsample[1] = 2 >> chroma_v_shift;
213  vsample[2] = 2 >> chroma_v_shift;
214  hsample[0] = 2;
215  hsample[1] = 2 >> chroma_h_shift;
216  hsample[2] = 2 >> chroma_h_shift;
217  }
218 }
219 
221  ScanTable *intra_scantable, int pred,
222  uint16_t luma_intra_matrix[64],
223  uint16_t chroma_intra_matrix[64])
224 {
225  const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG && avctx->codec_id != AV_CODEC_ID_AMV;
226  int hsample[4], vsample[4];
227  int i;
228  int components = 3 + (avctx->pix_fmt == AV_PIX_FMT_BGRA);
229  int chroma_matrix = !!memcmp(luma_intra_matrix,
230  chroma_intra_matrix,
231  sizeof(luma_intra_matrix[0])*64);
232 
233  ff_mjpeg_init_hvsample(avctx, hsample, vsample);
234 
235  put_marker(pb, SOI);
236 
237  // hack for AMV mjpeg format
238  if(avctx->codec_id == AV_CODEC_ID_AMV) goto end;
239 
240  jpeg_put_comments(avctx, pb);
241 
242  jpeg_table_header(avctx, pb, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample);
243 
244  switch (avctx->codec_id) {
245  case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break;
246  case AV_CODEC_ID_LJPEG: put_marker(pb, SOF3 ); break;
247  default: av_assert0(0);
248  }
249 
250  put_bits(pb, 16, 17);
251  if (lossless && ( avctx->pix_fmt == AV_PIX_FMT_BGR0
252  || avctx->pix_fmt == AV_PIX_FMT_BGRA
253  || avctx->pix_fmt == AV_PIX_FMT_BGR24))
254  put_bits(pb, 8, 9); /* 9 bits/component RCT */
255  else
256  put_bits(pb, 8, 8); /* 8 bits/component */
257  put_bits(pb, 16, avctx->height);
258  put_bits(pb, 16, avctx->width);
259  put_bits(pb, 8, components); /* 3 or 4 components */
260 
261  /* Y component */
262  put_bits(pb, 8, 1); /* component number */
263  put_bits(pb, 4, hsample[0]); /* H factor */
264  put_bits(pb, 4, vsample[0]); /* V factor */
265  put_bits(pb, 8, 0); /* select matrix */
266 
267  /* Cb component */
268  put_bits(pb, 8, 2); /* component number */
269  put_bits(pb, 4, hsample[1]); /* H factor */
270  put_bits(pb, 4, vsample[1]); /* V factor */
271  put_bits(pb, 8, lossless ? 0 : chroma_matrix); /* select matrix */
272 
273  /* Cr component */
274  put_bits(pb, 8, 3); /* component number */
275  put_bits(pb, 4, hsample[2]); /* H factor */
276  put_bits(pb, 4, vsample[2]); /* V factor */
277  put_bits(pb, 8, lossless ? 0 : chroma_matrix); /* select matrix */
278 
279  if (components == 4) {
280  put_bits(pb, 8, 4); /* component number */
281  put_bits(pb, 4, hsample[3]); /* H factor */
282  put_bits(pb, 4, vsample[3]); /* V factor */
283  put_bits(pb, 8, 0); /* select matrix */
284  }
285 
286  /* scan header */
287  put_marker(pb, SOS);
288  put_bits(pb, 16, 6 + 2*components); /* length */
289  put_bits(pb, 8, components); /* 3 components */
290 
291  /* Y component */
292  put_bits(pb, 8, 1); /* index */
293  put_bits(pb, 4, 0); /* DC huffman table index */
294  put_bits(pb, 4, 0); /* AC huffman table index */
295 
296  /* Cb component */
297  put_bits(pb, 8, 2); /* index */
298  put_bits(pb, 4, 1); /* DC huffman table index */
299  put_bits(pb, 4, lossless ? 0 : 1); /* AC huffman table index */
300 
301  /* Cr component */
302  put_bits(pb, 8, 3); /* index */
303  put_bits(pb, 4, 1); /* DC huffman table index */
304  put_bits(pb, 4, lossless ? 0 : 1); /* AC huffman table index */
305 
306  if (components == 4) {
307  /* Alpha component */
308  put_bits(pb, 8, 4); /* index */
309  put_bits(pb, 4, 0); /* DC huffman table index */
310  put_bits(pb, 4, 0); /* AC huffman table index */
311  }
312 
313  put_bits(pb, 8, lossless ? pred : 0); /* Ss (not used) */
314 
315  switch (avctx->codec_id) {
316  case AV_CODEC_ID_MJPEG: put_bits(pb, 8, 63); break; /* Se (not used) */
317  case AV_CODEC_ID_LJPEG: put_bits(pb, 8, 0); break; /* not used */
318  default: av_assert0(0);
319  }
320 
321  put_bits(pb, 8, 0); /* Ah/Al (not used) */
322 
323 end:
324  if (!lossless) {
325  MpegEncContext *s = avctx->priv_data;
326  av_assert0(avctx->codec->priv_data_size == sizeof(MpegEncContext));
327 
328  s->esc_pos = put_bits_count(pb) >> 3;
329  for(i=1; i<s->slice_context_count; i++)
330  s->thread_context[i]->esc_pos = 0;
331  }
332 }
333 
334 void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
335 {
336  int size;
337  int i, ff_count;
338  uint8_t *buf = pb->buf + start;
339  int align= (-(size_t)(buf))&3;
340  int pad = (-put_bits_count(pb))&7;
341 
342  if (pad)
343  put_bits(pb, pad, (1<<pad)-1);
344 
345  flush_put_bits(pb);
346  size = put_bits_count(pb) - start * 8;
347 
348  av_assert1((size&7) == 0);
349  size >>= 3;
350 
351  ff_count=0;
352  for(i=0; i<size && i<align; i++){
353  if(buf[i]==0xFF) ff_count++;
354  }
355  for(; i<size-15; i+=16){
356  int acc, v;
357 
358  v= *(uint32_t*)(&buf[i]);
359  acc= (((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
360  v= *(uint32_t*)(&buf[i+4]);
361  acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
362  v= *(uint32_t*)(&buf[i+8]);
363  acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
364  v= *(uint32_t*)(&buf[i+12]);
365  acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
366 
367  acc>>=4;
368  acc+= (acc>>16);
369  acc+= (acc>>8);
370  ff_count+= acc&0xFF;
371  }
372  for(; i<size; i++){
373  if(buf[i]==0xFF) ff_count++;
374  }
375 
376  if(ff_count==0) return;
377 
378  flush_put_bits(pb);
379  skip_put_bytes(pb, ff_count);
380 
381  for(i=size-1; ff_count; i--){
382  int v= buf[i];
383 
384  if(v==0xFF){
385  buf[i+ff_count]= 0;
386  ff_count--;
387  }
388 
389  buf[i+ff_count]= v;
390  }
391 }
392 
393 /* isn't this function nicer than the one in the libjpeg ? */
394 void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
395  const uint8_t *bits_table,
396  const uint8_t *val_table)
397 {
398  int k, code;
399 
400  k = 0;
401  code = 0;
402  for (int i = 1; i <= 16; i++) {
403  int nb = bits_table[i];
404  for (int j = 0; j < nb; j++) {
405  int sym = val_table[k++];
406  huff_size[sym] = i;
407  huff_code[sym] = code;
408  code++;
409  }
410  code <<= 1;
411  }
412 }
413 
415 {
416  av_assert1((header_bits & 7) == 0);
417 
418  put_marker(pb, EOI);
419 }
420 
422  uint8_t *huff_size, uint16_t *huff_code)
423 {
424  int mant, nbits;
425 
426  if (val == 0) {
427  put_bits(pb, huff_size[0], huff_code[0]);
428  } else {
429  mant = val;
430  if (val < 0) {
431  val = -val;
432  mant--;
433  }
434 
435  nbits= av_log2_16bit(val) + 1;
436 
437  put_bits(pb, huff_size[nbits], huff_code[nbits]);
438 
439  put_sbits(pb, nbits, mant);
440  }
441 }
ff_mjpeg_encode_dc
void ff_mjpeg_encode_dc(PutBitContext *pb, int val, uint8_t *huff_size, uint16_t *huff_code)
Definition: mjpegenc_common.c:421
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
jpegtables.h
mjpeg.h
acc
int acc
Definition: yuv2rgb.c:555
LIBAVCODEC_IDENT
#define LIBAVCODEC_IDENT
Definition: version.h:42
SOS
@ SOS
Definition: mjpeg.h:72
mjpegenc_common.h
SOF0
@ SOF0
Definition: mjpeg.h:39
avpriv_mjpeg_bits_ac_luminance
const uint8_t avpriv_mjpeg_bits_ac_luminance[17]
Definition: jpegtables.c:73
jpeg_table_header
static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p, ScanTable *intra_scantable, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64], int hsample[3])
Definition: mjpegenc_common.c:58
put_sbits
static void put_sbits(PutBitContext *pb, int n, int32_t value)
Definition: put_bits.h:253
ff_mjpeg_encode_picture_header
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, ScanTable *intra_scantable, int pred, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64])
Definition: mjpegenc_common.c:220
av_log2_16bit
int av_log2_16bit(unsigned v)
Definition: intmath.c:31
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:218
avpriv_mjpeg_val_ac_luminance
const uint8_t avpriv_mjpeg_val_ac_luminance[]
Definition: jpegtables.c:75
pixdesc.h
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:586
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
put_huffman_table
static int put_huffman_table(PutBitContext *p, int table_class, int table_id, const uint8_t *bits_table, const uint8_t *value_table)
Definition: mjpegenc_common.c:38
avpriv_mjpeg_bits_dc_luminance
const uint8_t avpriv_mjpeg_bits_dc_luminance[17]
Definition: jpegtables.c:65
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:545
SOF3
@ SOF3
Definition: mjpeg.h:42
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:616
val
static double val(void *priv, double ch)
Definition: aeval.c:76
av_pix_fmt_get_chroma_sub_sample
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
Definition: pixdesc.c:2601
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
avpriv_mjpeg_bits_dc_chrominance
const uint8_t avpriv_mjpeg_bits_dc_chrominance[17]
Definition: jpegtables.c:70
COM
@ COM
Definition: mjpeg.h:111
s
#define s(width, name)
Definition: cbs_vp9.c:257
avpriv_mjpeg_val_dc
const uint8_t avpriv_mjpeg_val_dc[12]
Definition: jpegtables.c:67
HUFFMAN_TABLE_OPTIMAL
@ HUFFMAN_TABLE_OPTIMAL
Compute and use optimal Huffman tables.
Definition: mjpegenc.h:97
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
ff_put_string
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
Put the string string in the bitstream.
Definition: bitstream.c:59
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
PutBitContext
Definition: put_bits.h:44
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:546
PutBitContext::buf
uint8_t * buf
Definition: put_bits.h:47
NULL
#define NULL
Definition: coverity.c:32
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:1171
AV_WB16
#define AV_WB16(p, v)
Definition: intreadwrite.h:405
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:240
DRI
@ DRI
Definition: mjpeg.h:75
avpriv_mjpeg_val_ac_chrominance
const uint8_t avpriv_mjpeg_val_ac_chrominance[]
Definition: jpegtables.c:102
size
int size
Definition: twinvq_data.h:10344
FF_THREAD_SLICE
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
Definition: avcodec.h:1785
DQT
@ DQT
Definition: mjpeg.h:73
AVCodec::id
enum AVCodecID id
Definition: codec.h:211
jpeg_put_comments
static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
Definition: mjpegenc_common.c:137
ff_mjpeg_build_huffman_codes
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, const uint8_t *bits_table, const uint8_t *val_table)
Definition: mjpegenc_common.c:394
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:56
i
int i
Definition: input.c:407
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
put_bits_count
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:76
EOI
@ EOI
Definition: mjpeg.h:71
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
uint8_t
uint8_t
Definition: audio_convert.c:194
DHT
@ DHT
Definition: mjpeg.h:56
AVCodecContext::height
int height
Definition: avcodec.h:709
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:746
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:569
AVCodec::priv_data_size
int priv_data_size
Definition: codec.h:245
idctdsp.h
avcodec.h
pred
static const float pred[4]
Definition: siprdata.h:259
pixfmt.h
AV_CODEC_ID_AMV
@ AV_CODEC_ID_AMV
Definition: codec_id.h:156
AVCodecContext
main external API structure.
Definition: avcodec.h:536
AVCodecContext::active_thread_type
int active_thread_type
Which multithreading methods are in use by the codec.
Definition: avcodec.h:1792
put_bits_ptr
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
Definition: put_bits.h:342
AVRational::den
int den
Denominator.
Definition: rational.h:60
ff_mjpeg_escape_FF
void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
Definition: mjpegenc_common.c:334
skip_put_bytes
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
Definition: put_bits.h:351
put_marker
static void put_marker(PutBitContext *p, enum JpegMarker code)
Definition: mjpegenc.h:101
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
APP0
@ APP0
Definition: mjpeg.h:79
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_CODEC_FLAG_BITEXACT
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:333
SOI
@ SOI
Definition: mjpeg.h:70
ff_mjpeg_init_hvsample
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4])
Definition: mjpegenc_common.c:193
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:110
ScanTable
Scantable.
Definition: idctdsp.h:31
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:563
ScanTable::permutated
uint8_t permutated[64]
Definition: idctdsp.h:33
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:709
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
ff_mjpeg_encode_picture_trailer
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
Definition: mjpegenc_common.c:414
avpriv_mjpeg_bits_ac_chrominance
const uint8_t avpriv_mjpeg_bits_ac_chrominance[17]
Definition: jpegtables.c:99
put_bits.h
mjpegenc.h
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:81
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:58
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:915