FFmpeg  4.0
jpeglsenc.c
Go to the documentation of this file.
1 /*
2  * JPEG-LS encoder
3  * Copyright (c) 2003 Michael Niedermayer
4  * Copyright (c) 2006 Konstantin Shishkov
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 /**
24  * @file
25  * JPEG-LS encoder.
26  */
27 
28 #include "avcodec.h"
29 #include "get_bits.h"
30 #include "put_bits.h"
31 #include "golomb.h"
32 #include "internal.h"
33 #include "mathops.h"
34 #include "mjpeg.h"
35 #include "mjpegenc.h"
36 #include "jpegls.h"
37 
38 typedef struct JPEGLSContext {
39  AVClass *class;
40 
41  int pred;
43 
44 /**
45  * Encode error from regular symbol
46  */
47 static inline void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q,
48  int err)
49 {
50  int k;
51  int val;
52  int map;
53 
54  for (k = 0; (state->N[Q] << k) < state->A[Q]; k++)
55  ;
56 
57  map = !state->near && !k && (2 * state->B[Q] <= -state->N[Q]);
58 
59  if (err < 0)
60  err += state->range;
61  if (err >= (state->range + 1 >> 1)) {
62  err -= state->range;
63  val = 2 * FFABS(err) - 1 - map;
64  } else
65  val = 2 * err + map;
66 
67  set_ur_golomb_jpegls(pb, val, k, state->limit, state->qbpp);
68 
69  ff_jpegls_update_state_regular(state, Q, err);
70 }
71 
72 /**
73  * Encode error from run termination
74  */
75 static inline void ls_encode_runterm(JLSState *state, PutBitContext *pb,
76  int RItype, int err, int limit_add)
77 {
78  int k;
79  int val, map;
80  int Q = 365 + RItype;
81  int temp;
82 
83  temp = state->A[Q];
84  if (RItype)
85  temp += state->N[Q] >> 1;
86  for (k = 0; (state->N[Q] << k) < temp; k++)
87  ;
88  map = 0;
89  if (!k && err && (2 * state->B[Q] < state->N[Q]))
90  map = 1;
91 
92  if (err < 0)
93  val = -(2 * err) - 1 - RItype + map;
94  else
95  val = 2 * err - RItype - map;
96  set_ur_golomb_jpegls(pb, val, k, state->limit - limit_add - 1, state->qbpp);
97 
98  if (err < 0)
99  state->B[Q]++;
100  state->A[Q] += (val + 1 - RItype) >> 1;
101 
102  ff_jpegls_downscale_state(state, Q);
103 }
104 
105 /**
106  * Encode run value as specified by JPEG-LS standard
107  */
108 static inline void ls_encode_run(JLSState *state, PutBitContext *pb, int run,
109  int comp, int trail)
110 {
111  while (run >= (1 << ff_log2_run[state->run_index[comp]])) {
112  put_bits(pb, 1, 1);
113  run -= 1 << ff_log2_run[state->run_index[comp]];
114  if (state->run_index[comp] < 31)
115  state->run_index[comp]++;
116  }
117  /* if hit EOL, encode another full run, else encode aborted run */
118  if (!trail && run) {
119  put_bits(pb, 1, 1);
120  } else if (trail) {
121  put_bits(pb, 1, 0);
122  if (ff_log2_run[state->run_index[comp]])
123  put_bits(pb, ff_log2_run[state->run_index[comp]], run);
124  }
125 }
126 
127 /**
128  * Encode one line of image
129  */
130 static inline void ls_encode_line(JLSState *state, PutBitContext *pb,
131  void *last, void *cur, int last2, int w,
132  int stride, int comp, int bits)
133 {
134  int x = 0;
135  int Ra, Rb, Rc, Rd;
136  int D0, D1, D2;
137 
138  while (x < w) {
139  int err, pred, sign;
140 
141  /* compute gradients */
142  Ra = x ? R(cur, x - stride) : R(last, x);
143  Rb = R(last, x);
144  Rc = x ? R(last, x - stride) : last2;
145  Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
146  D0 = Rd - Rb;
147  D1 = Rb - Rc;
148  D2 = Rc - Ra;
149 
150  /* run mode */
151  if ((FFABS(D0) <= state->near) &&
152  (FFABS(D1) <= state->near) &&
153  (FFABS(D2) <= state->near)) {
154  int RUNval, RItype, run;
155 
156  run = 0;
157  RUNval = Ra;
158  while (x < w && (FFABS(R(cur, x) - RUNval) <= state->near)) {
159  run++;
160  W(cur, x, Ra);
161  x += stride;
162  }
163  ls_encode_run(state, pb, run, comp, x < w);
164  if (x >= w)
165  return;
166  Rb = R(last, x);
167  RItype = FFABS(Ra - Rb) <= state->near;
168  pred = RItype ? Ra : Rb;
169  err = R(cur, x) - pred;
170 
171  if (!RItype && Ra > Rb)
172  err = -err;
173 
174  if (state->near) {
175  if (err > 0)
176  err = (state->near + err) / state->twonear;
177  else
178  err = -(state->near - err) / state->twonear;
179 
180  if (RItype || (Rb >= Ra))
181  Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
182  else
183  Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
184  W(cur, x, Ra);
185  }
186  if (err < 0)
187  err += state->range;
188  if (err >= state->range + 1 >> 1)
189  err -= state->range;
190 
191  ls_encode_runterm(state, pb, RItype, err,
192  ff_log2_run[state->run_index[comp]]);
193 
194  if (state->run_index[comp] > 0)
195  state->run_index[comp]--;
196  } else { /* regular mode */
197  int context;
198 
199  context = ff_jpegls_quantize(state, D0) * 81 +
200  ff_jpegls_quantize(state, D1) * 9 +
201  ff_jpegls_quantize(state, D2);
202  pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
203 
204  if (context < 0) {
205  context = -context;
206  sign = 1;
207  pred = av_clip(pred - state->C[context], 0, state->maxval);
208  err = pred - R(cur, x);
209  } else {
210  sign = 0;
211  pred = av_clip(pred + state->C[context], 0, state->maxval);
212  err = R(cur, x) - pred;
213  }
214 
215  if (state->near) {
216  if (err > 0)
217  err = (state->near + err) / state->twonear;
218  else
219  err = -(state->near - err) / state->twonear;
220  if (!sign)
221  Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
222  else
223  Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
224  W(cur, x, Ra);
225  }
226 
227  ls_encode_regular(state, pb, context, err);
228  }
229  x += stride;
230  }
231 }
232 
234 {
235  /* Test if we have default params and don't need to store LSE */
236  JLSState state2 = { 0 };
237  state2.bpp = state->bpp;
238  state2.near = state->near;
240  if (state->T1 == state2.T1 &&
241  state->T2 == state2.T2 &&
242  state->T3 == state2.T3 &&
243  state->reset == state2.reset)
244  return;
245  /* store LSE type 1 */
246  put_marker(pb, LSE);
247  put_bits(pb, 16, 13);
248  put_bits(pb, 8, 1);
249  put_bits(pb, 16, state->maxval);
250  put_bits(pb, 16, state->T1);
251  put_bits(pb, 16, state->T2);
252  put_bits(pb, 16, state->T3);
253  put_bits(pb, 16, state->reset);
254 }
255 
257  const AVFrame *pict, int *got_packet)
258 {
259  JPEGLSContext *ctx = avctx->priv_data;
260  const AVFrame *const p = pict;
261  PutBitContext pb, pb2;
262  GetBitContext gb;
263  uint8_t *buf2 = NULL;
264  uint8_t *zero = NULL;
265  uint8_t *cur = NULL;
266  uint8_t *last = NULL;
267  JLSState *state = NULL;
268  int i, size, ret;
269  int comps;
270 
271 #if FF_API_PRIVATE_OPT
273  if (avctx->prediction_method)
274  ctx->pred = avctx->prediction_method;
276 #endif
277 
278  if (avctx->pix_fmt == AV_PIX_FMT_GRAY8 ||
279  avctx->pix_fmt == AV_PIX_FMT_GRAY16)
280  comps = 1;
281  else
282  comps = 3;
283 
284  if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width *avctx->height * comps * 4 +
285  AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
286  return ret;
287 
288  buf2 = av_malloc(pkt->size);
289  if (!buf2)
290  goto memfail;
291 
292  init_put_bits(&pb, pkt->data, pkt->size);
293  init_put_bits(&pb2, buf2, pkt->size);
294 
295  /* write our own JPEG header, can't use mjpeg_picture_header */
296  put_marker(&pb, SOI);
297  put_marker(&pb, SOF48);
298  put_bits(&pb, 16, 8 + comps * 3); // header size depends on components
299  put_bits(&pb, 8, (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8); // bpp
300  put_bits(&pb, 16, avctx->height);
301  put_bits(&pb, 16, avctx->width);
302  put_bits(&pb, 8, comps); // components
303  for (i = 1; i <= comps; i++) {
304  put_bits(&pb, 8, i); // component ID
305  put_bits(&pb, 8, 0x11); // subsampling: none
306  put_bits(&pb, 8, 0); // Tiq, used by JPEG-LS ext
307  }
308 
309  put_marker(&pb, SOS);
310  put_bits(&pb, 16, 6 + comps * 2);
311  put_bits(&pb, 8, comps);
312  for (i = 1; i <= comps; i++) {
313  put_bits(&pb, 8, i); // component ID
314  put_bits(&pb, 8, 0); // mapping index: none
315  }
316  put_bits(&pb, 8, ctx->pred);
317  put_bits(&pb, 8, (comps > 1) ? 1 : 0); // interleaving: 0 - plane, 1 - line
318  put_bits(&pb, 8, 0); // point transform: none
319 
320  state = av_mallocz(sizeof(JLSState));
321  if (!state)
322  goto memfail;
323 
324  /* initialize JPEG-LS state from JPEG parameters */
325  state->near = ctx->pred;
326  state->bpp = (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8;
328  ff_jpegls_init_state(state);
329 
330  ls_store_lse(state, &pb);
331 
332  zero = last = av_mallocz(FFABS(p->linesize[0]));
333  if (!zero)
334  goto memfail;
335 
336  cur = p->data[0];
337  if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
338  int t = 0;
339 
340  for (i = 0; i < avctx->height; i++) {
341  ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 8);
342  t = last[0];
343  last = cur;
344  cur += p->linesize[0];
345  }
346  } else if (avctx->pix_fmt == AV_PIX_FMT_GRAY16) {
347  int t = 0;
348 
349  for (i = 0; i < avctx->height; i++) {
350  ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 16);
351  t = *((uint16_t *)last);
352  last = cur;
353  cur += p->linesize[0];
354  }
355  } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
356  int j, width;
357  int Rc[3] = { 0, 0, 0 };
358 
359  width = avctx->width * 3;
360  for (i = 0; i < avctx->height; i++) {
361  for (j = 0; j < 3; j++) {
362  ls_encode_line(state, &pb2, last + j, cur + j, Rc[j],
363  width, 3, j, 8);
364  Rc[j] = last[j];
365  }
366  last = cur;
367  cur += p->linesize[0];
368  }
369  } else if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
370  int j, width;
371  int Rc[3] = { 0, 0, 0 };
372 
373  width = avctx->width * 3;
374  for (i = 0; i < avctx->height; i++) {
375  for (j = 2; j >= 0; j--) {
376  ls_encode_line(state, &pb2, last + j, cur + j, Rc[j],
377  width, 3, j, 8);
378  Rc[j] = last[j];
379  }
380  last = cur;
381  cur += p->linesize[0];
382  }
383  }
384 
385  av_freep(&zero);
386  av_freep(&state);
387 
388  /* the specification says that after doing 0xff escaping unused bits in
389  * the last byte must be set to 0, so just append 7 "optional" zero bits
390  * to avoid special-casing. */
391  put_bits(&pb2, 7, 0);
392  size = put_bits_count(&pb2);
393  flush_put_bits(&pb2);
394  /* do escape coding */
395  init_get_bits(&gb, buf2, size);
396  size -= 7;
397  while (get_bits_count(&gb) < size) {
398  int v;
399  v = get_bits(&gb, 8);
400  put_bits(&pb, 8, v);
401  if (v == 0xFF) {
402  v = get_bits(&gb, 7);
403  put_bits(&pb, 8, v);
404  }
405  }
407  av_freep(&buf2);
408 
409  /* End of image */
410  put_marker(&pb, EOI);
411  flush_put_bits(&pb);
412 
413  emms_c();
414 
415  pkt->size = put_bits_count(&pb) >> 3;
416  pkt->flags |= AV_PKT_FLAG_KEY;
417  *got_packet = 1;
418  return 0;
419 
420 memfail:
421  av_packet_unref(pkt);
422  av_freep(&buf2);
423  av_freep(&state);
424  av_freep(&zero);
425  return AVERROR(ENOMEM);
426 }
427 
429 {
430 #if FF_API_CODED_FRAME
433  ctx->coded_frame->key_frame = 1;
435 #endif
436 
437  if (ctx->pix_fmt != AV_PIX_FMT_GRAY8 &&
438  ctx->pix_fmt != AV_PIX_FMT_GRAY16 &&
439  ctx->pix_fmt != AV_PIX_FMT_RGB24 &&
440  ctx->pix_fmt != AV_PIX_FMT_BGR24) {
441  av_log(ctx, AV_LOG_ERROR,
442  "Only grayscale and RGB24/BGR24 images are supported\n");
443  return -1;
444  }
445  return 0;
446 }
447 
448 #define OFFSET(x) offsetof(JPEGLSContext, x)
449 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
450 static const AVOption options[] = {
451 { "pred", "Prediction method", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE, "pred" },
452  { "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
453  { "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
454  { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "pred" },
455 
456  { NULL},
457 };
458 
459 static const AVClass jpegls_class = {
460  .class_name = "jpegls",
461  .item_name = av_default_item_name,
462  .option = options,
463  .version = LIBAVUTIL_VERSION_INT,
464 };
465 
467  .name = "jpegls",
468  .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
469  .type = AVMEDIA_TYPE_VIDEO,
470  .id = AV_CODEC_ID_JPEGLS,
471  .priv_data_size = sizeof(JPEGLSContext),
472  .priv_class = &jpegls_class,
473  .init = encode_init_ls,
475  .encode2 = encode_picture_ls,
476  .pix_fmts = (const enum AVPixelFormat[]) {
480  },
481  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
483 };
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
int reset
Definition: jpegls.h:44
#define NULL
Definition: coverity.c:32
const uint8_t ff_log2_run[41]
Definition: bitstream.c:39
const char const char void * val
Definition: avisynth_c.h:771
int T2
Definition: jpegls.h:42
int size
This structure describes decoded (raw) audio or video data.
Definition: frame.h:218
AVCodec ff_jpegls_encoder
Definition: jpeglsenc.c:466
AVOption.
Definition: opt.h:246
Definition: mjpeg.h:71
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:207
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:269
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
static void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q, int err)
Encode error from regular symbol.
Definition: jpeglsenc.c:47
else temp
Definition: vf_mcdeint.c:256
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
MJPEG encoder.
int size
Definition: avcodec.h:1431
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
int C[365]
Definition: jpegls.h:43
void avpriv_align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
Definition: bitstream.c:48
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1727
int twonear
Definition: jpegls.h:45
uint8_t run
Definition: svq3.c:206
static AVPacket pkt
int limit
Definition: jpegls.h:44
int stride
Definition: mace.c:144
AVCodec.
Definition: avcodec.h:3408
MJPEG encoder and decoder.
#define AV_CODEC_CAP_INTRA_ONLY
Codec is intra only.
Definition: avcodec.h:1045
int bpp
Definition: jpegls.h:44
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
int maxval
Definition: jpegls.h:44
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
Definition: encode.c:32
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
static const AVOption options[]
Definition: jpeglsenc.c:450
Definition: mjpeg.h:72
uint8_t
#define av_cold
Definition: attributes.h:82
#define av_malloc(s)
#define emms_c()
Definition: internal.h:55
uint8_t * data
Definition: avcodec.h:1430
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:200
static void ls_encode_line(JLSState *state, PutBitContext *pb, void *last, void *cur, int last2, int w, int stride, int comp, int bits)
Encode one line of image.
Definition: jpeglsenc.c:130
bitstream reader API header.
#define AV_INPUT_BUFFER_MIN_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
Definition: avcodec.h:780
#define VE
Definition: jpeglsenc.c:449
#define av_log(a,...)
static void ls_encode_run(JLSState *state, PutBitContext *pb, int run, int comp, int trail)
Encode run value as specified by JPEG-LS standard.
Definition: jpeglsenc.c:108
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1462
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define R
Definition: huffyuvdsp.h:34
#define AVERROR(e)
Definition: error.h:43
static void ls_store_lse(JLSState *state, PutBitContext *pb)
Definition: jpeglsenc.c:233
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define zero
Definition: regdef.h:64
uint16_t width
Definition: gdv.c:47
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
Calculate JPEG-LS codec values.
Definition: jpegls.c:62
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
const char * name
Name of the codec implementation.
Definition: avcodec.h:3415
static int ff_jpegls_update_state_regular(JLSState *state, int Q, int err)
Definition: jpegls.h:99
int B[367]
Definition: jpegls.h:43
static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: jpeglsenc.c:256
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1015
Definition: mjpeg.h:70
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1436
int near
Definition: jpegls.h:45
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:85
JPEG-LS.
Definition: mjpeg.h:103
static void put_marker(PutBitContext *p, enum JpegMarker code)
Definition: mjpegenc.h:101
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:301
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:352
int width
picture width / height.
Definition: avcodec.h:1690
uint8_t w
Definition: llviddspenc.c:38
AVFormatContext * ctx
Definition: movenc.c:48
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
static void ls_encode_runterm(JLSState *state, PutBitContext *pb, int RItype, int err, int limit_add)
Encode error from run termination.
Definition: jpeglsenc.c:75
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:65
static void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len)
write unsigned golomb rice code (jpegls).
Definition: golomb.h:536
static struct @271 state
int qbpp
Definition: jpegls.h:44
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:83
Libavcodec external API header.
#define OFFSET(x)
Definition: jpeglsenc.c:448
attribute_deprecated int prediction_method
Definition: avcodec.h:1876
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:249
main external API structure.
Definition: avcodec.h:1518
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:592
int A[367]
Definition: jpegls.h:43
Describe the class of an AVClass context structure.
Definition: log.h:67
#define W(a, i, v)
Definition: jpegls.h:124
JPEG-LS common code.
int T1
Definition: jpegls.h:42
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:433
int range
Definition: jpegls.h:44
int N[367]
Definition: jpegls.h:43
#define mid_pred
Definition: mathops.h:97
static const AVClass jpegls_class
Definition: jpeglsenc.c:459
const VDPAUPixFmtMap * map
static av_cold int encode_init_ls(AVCodecContext *ctx)
Definition: jpeglsenc.c:428
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
JPEG-LS extension parameters.
Definition: mjpeg.h:104
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:232
Y , 8bpp.
Definition: pixfmt.h:70
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:84
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:101
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
Definition: avcodec.h:2760
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:48
void * priv_data
Definition: avcodec.h:1545
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:85
static int ff_jpegls_quantize(JLSState *s, int v)
Calculate quantized gradient value, used for context determination.
Definition: jpegls.h:57
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:296
#define av_freep(p)
int T3
Definition: jpegls.h:42
void ff_jpegls_init_state(JLSState *state)
Calculate initial JPEG-LS parameters.
Definition: jpegls.c:31
exp golomb vlc stuff
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
This structure stores compressed data.
Definition: avcodec.h:1407
int run_index[4]
Definition: jpegls.h:46
static void ff_jpegls_downscale_state(JLSState *state, int Q)
Definition: jpegls.h:89
bitstream writer API