FFmpeg
jpeglsdec.c
Go to the documentation of this file.
1 /*
2  * JPEG-LS decoder
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 decoder.
26  */
27 
28 #include "libavutil/attributes.h"
29 #include "libavutil/mem.h"
30 #include "avcodec.h"
31 #include "codec_internal.h"
32 #include "get_bits.h"
33 #include "golomb.h"
34 #include "mathops.h"
35 #include "mjpegdec.h"
36 #include "jpegls.h"
37 #include "jpeglsdec.h"
38 
39 /*
40  * Uncomment this to significantly speed up decoding of broken JPEG-LS
41  * (or test broken JPEG-LS decoder) and slow down ordinary decoding a bit.
42  *
43  * There is no Golomb code with length >= 32 bits possible, so check and
44  * avoid situation of 32 zeros, FFmpeg Golomb decoder is painfully slow
45  * on this errors.
46  */
47 //#define JLS_BROKEN
48 
49 /**
50  * Decode LSE block with initialization parameters
51  */
53 {
54  int id;
55  int tid, wt, maxtab, i, j;
56 
57  int len = bytestream2_get_be16(&s->gB);
58  id = bytestream2_get_byte(&s->gB);
59 
60  switch (id) {
61  case 1:
62  if (len < 13)
63  return AVERROR_INVALIDDATA;
64 
65  s->maxval = bytestream2_get_be16u(&s->gB);
66  s->t1 = bytestream2_get_be16u(&s->gB);
67  s->t2 = bytestream2_get_be16u(&s->gB);
68  s->t3 = bytestream2_get_be16u(&s->gB);
69  s->reset = bytestream2_get_be16u(&s->gB);
70 
71  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
72  av_log(s->avctx, AV_LOG_DEBUG, "Coding parameters maxval:%d T1:%d T2:%d T3:%d reset:%d\n",
73  s->maxval, s->t1, s->t2, s->t3, s->reset);
74  }
75 
76 // ff_jpegls_reset_coding_parameters(s, 0);
77  //FIXME quant table?
78  break;
79  case 2:
80  s->palette_index = 0;
82  case 3:
83  tid= bytestream2_get_byte(&s->gB);
84  wt = bytestream2_get_byte(&s->gB);
85 
86  if (len < 5)
87  return AVERROR_INVALIDDATA;
88 
89  if (wt < 1 || wt > MAX_COMPONENTS) {
90  avpriv_request_sample(s->avctx, "wt %d", wt);
91  return AVERROR_PATCHWELCOME;
92  }
93 
94  if (!s->maxval)
95  maxtab = 255;
96  else if ((5 + wt*(s->maxval+1)) < 65535)
97  maxtab = s->maxval;
98  else
99  maxtab = 65530/wt - 1;
100 
101  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
102  av_log(s->avctx, AV_LOG_DEBUG, "LSE palette %d tid:%d wt:%d maxtab:%d\n", id, tid, wt, maxtab);
103  }
104  if (maxtab >= 256) {
105  avpriv_request_sample(s->avctx, ">8bit palette");
106  return AVERROR_PATCHWELCOME;
107  }
108  maxtab = FFMIN(maxtab, (len - 5) / wt + s->palette_index);
109 
110  if (s->palette_index > maxtab)
111  return AVERROR_INVALIDDATA;
112 
113  if ((s->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || s->avctx->pix_fmt == AV_PIX_FMT_PAL8) &&
114  (s->picture_ptr->format == AV_PIX_FMT_GRAY8 || s->picture_ptr->format == AV_PIX_FMT_PAL8)) {
115  uint32_t *pal = (uint32_t *)s->picture_ptr->data[1];
116  int shift = 0;
117 
118  if (s->avctx->bits_per_raw_sample > 0 && s->avctx->bits_per_raw_sample < 8) {
119  maxtab = FFMIN(maxtab, (1<<s->avctx->bits_per_raw_sample)-1);
120  shift = 8 - s->avctx->bits_per_raw_sample;
121  }
122 
123  s->force_pal8++;
124  if (!pal) {
125  if (s->force_pal8 > 1)
126  return AVERROR_INVALIDDATA;
127  return 1;
128  }
129 
130  for (i=s->palette_index; i<=maxtab; i++) {
131  uint8_t k = i << shift;
132  pal[k] = wt < 4 ? 0xFF000000 : 0;
133  for (j=0; j<wt; j++) {
134  pal[k] |= bytestream2_get_byte(&s->gB) << (8*(wt-j-1));
135  }
136  }
137  s->palette_index = i;
138  }
139  break;
140  case 4:
141  avpriv_request_sample(s->avctx, "oversize image");
142  return AVERROR(ENOSYS);
143  default:
144  av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
145  return AVERROR_INVALIDDATA;
146  }
147  ff_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
148 
149  return 0;
150 }
151 
152 /**
153  * Get context-dependent Golomb code, decode it and update context
154  */
155 static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
156 {
157  int k, ret;
158 
159  for (k = 0; ((unsigned)state->N[Q] << k) < state->A[Q]; k++)
160  ;
161 
162 #ifdef JLS_BROKEN
163  if (!show_bits_long(gb, 32))
164  return -1;
165 #endif
166  ret = get_ur_golomb_jpegls(gb, k, state->limit, state->qbpp);
167 
168  /* decode mapped error */
169  if (ret & 1)
170  ret = -(ret + 1 >> 1);
171  else
172  ret >>= 1;
173 
174  /* for NEAR=0, k=0 and 2*B[Q] <= - N[Q] mapping is reversed */
175  if (!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
176  ret = -(ret + 1);
177 
179 
180  return ret;
181 }
182 
183 /**
184  * Get Golomb code, decode it and update state for run termination
185  */
187  int RItype, int limit_add)
188 {
189  int k, ret, temp, map;
190  int Q = 365 + RItype;
191 
192  temp = state->A[Q];
193  if (RItype)
194  temp += state->N[Q] >> 1;
195 
196  for (k = 0; ((unsigned)state->N[Q] << k) < temp; k++)
197  ;
198 
199 #ifdef JLS_BROKEN
200  if (!show_bits_long(gb, 32))
201  return -1;
202 #endif
203  ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1,
204  state->qbpp);
205  if (ret < 0)
206  return -0x10000;
207 
208  /* decode mapped error */
209  map = 0;
210  if (!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
211  map = 1;
212  ret += RItype + map;
213 
214  if (ret & 1) {
215  ret = map - (ret + 1 >> 1);
216  state->B[Q]++;
217  } else {
218  ret = ret >> 1;
219  }
220 
221  if (FFABS(ret) > 0xFFFF)
222  return -0x10000;
223  /* update state */
224  state->A[Q] += FFABS(ret) - RItype;
225  ret *= state->twonear;
227 
228  return ret;
229 }
230 
231 /**
232  * Decode one line of image
233  */
235  void *last, void *dst, int last2, int w,
236  int stride, int comp, int bits)
237 {
238  int i, x = 0;
239  int Ra, Rb, Rc, Rd;
240  int D0, D1, D2;
241 
242  while (x < w) {
243  int err, pred;
244 
245  if (get_bits_left(&s->gb) <= 0)
246  return AVERROR_INVALIDDATA;
247 
248  /* compute gradients */
249  Ra = x ? R(dst, x - stride) : R(last, x);
250  Rb = R(last, x);
251  Rc = x ? R(last, x - stride) : last2;
252  Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
253  D0 = Rd - Rb;
254  D1 = Rb - Rc;
255  D2 = Rc - Ra;
256  /* run mode */
257  if ((FFABS(D0) <= state->near) &&
258  (FFABS(D1) <= state->near) &&
259  (FFABS(D2) <= state->near)) {
260  int r;
261  int RItype;
262 
263  /* decode full runs while available */
264  while (get_bits1(&s->gb)) {
265  int r;
266  r = 1 << ff_log2_run[state->run_index[comp]];
267  if (x + r * stride > w)
268  r = (w - x) / stride;
269  for (i = 0; i < r; i++) {
270  W(dst, x, Ra);
271  x += stride;
272  }
273  /* if EOL reached, we stop decoding */
274  if (r != 1 << ff_log2_run[state->run_index[comp]])
275  return 0;
276  if (state->run_index[comp] < 31)
277  state->run_index[comp]++;
278  if (x + stride > w)
279  return 0;
280  }
281  /* decode aborted run */
282  r = ff_log2_run[state->run_index[comp]];
283  if (r)
284  r = get_bits(&s->gb, r);
285  if (x + r * stride > w) {
286  r = (w - x) / stride;
287  }
288  for (i = 0; i < r; i++) {
289  W(dst, x, Ra);
290  x += stride;
291  }
292 
293  if (x >= w) {
294  av_log(NULL, AV_LOG_ERROR, "run overflow\n");
295  av_assert0(x <= w);
296  return AVERROR_INVALIDDATA;
297  }
298 
299  /* decode run termination value */
300  Rb = R(last, x);
301  RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
302  err = ls_get_code_runterm(&s->gb, state, RItype,
303  ff_log2_run[state->run_index[comp]]);
304  if (state->run_index[comp])
305  state->run_index[comp]--;
306 
307  if (state->near && RItype) {
308  pred = Ra + err;
309  } else {
310  if (Rb < Ra)
311  pred = Rb - err;
312  else
313  pred = Rb + err;
314  }
315  } else { /* regular mode */
316  int context, sign;
317 
318  context = ff_jpegls_quantize(state, D0) * 81 +
319  ff_jpegls_quantize(state, D1) * 9 +
321  pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
322 
323  if (context < 0) {
324  context = -context;
325  sign = 1;
326  } else {
327  sign = 0;
328  }
329 
330  if (sign) {
331  pred = av_clip(pred - state->C[context], 0, state->maxval);
332  err = -ls_get_code_regular(&s->gb, state, context);
333  } else {
334  pred = av_clip(pred + state->C[context], 0, state->maxval);
335  err = ls_get_code_regular(&s->gb, state, context);
336  }
337 
338  /* we have to do something more for near-lossless coding */
339  pred += err;
340  }
341  if (state->near) {
342  if (pred < -state->near)
343  pred += state->range * state->twonear;
344  else if (pred > state->maxval + state->near)
345  pred -= state->range * state->twonear;
346  pred = av_clip(pred, 0, state->maxval);
347  }
348 
349  pred &= state->maxval;
350  W(dst, x, pred);
351  x += stride;
352  }
353 
354  return 0;
355 }
356 
358 {
359  int near = s->Ss;
360  int point_transform = s->Al;
361  int ilv = s->Se;
362  int i, t = 0;
363  uint8_t *zero, *last, *cur;
364  JLSState *state = s->jls_state;
365  int off = 0, stride = 1, width, shift, ret = 0;
366  int decoded_height = 0;
367 
368  if (!state) {
369  state = av_malloc(sizeof(*state));
370  if (!state)
371  return AVERROR(ENOMEM);
372  s->jls_state = state;
373  }
374  zero = av_mallocz(s->picture_ptr->linesize[0]);
375  if (!zero)
376  return AVERROR(ENOMEM);
377  last = zero;
378  cur = s->picture_ptr->data[0];
379 
380  /* initialize JPEG-LS state from JPEG parameters */
381  state->near = near;
382  state->bpp = (s->bits < 2) ? 2 : s->bits;
383  state->maxval = s->maxval;
384  state->T1 = s->t1;
385  state->T2 = s->t2;
386  state->T3 = s->t3;
387  state->reset = s->reset;
389 
390  /* Testing parameters here, we cannot test in LSE or SOF because
391  * these interdepend and are allowed in either order
392  */
393  if (state->maxval >= (1<<state->bpp) ||
394  state->T1 > state->T2 ||
395  state->T2 > state->T3 ||
396  state->T3 > state->maxval ||
397  state->reset > FFMAX(255, state->maxval)) {
399  goto end;
400  }
401 
402  if (s->bits <= 8)
403  shift = point_transform + (8 - s->bits);
404  else
405  shift = point_transform + (16 - s->bits);
406 
407  if (shift >= 16) {
409  goto end;
410  }
411 
412  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
413  av_log(s->avctx, AV_LOG_DEBUG,
414  "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
415  "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
416  s->width, s->height, state->near, state->maxval,
417  state->T1, state->T2, state->T3,
418  state->reset, state->limit, state->qbpp, state->range);
419  av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
420  ilv, point_transform, s->bits, s->cur_scan);
421  }
422 
423  s->restart_count = -1;
424 
425  if (ilv == 0) { /* separate planes */
426  if (s->cur_scan > s->nb_components) {
428  goto end;
429  }
430  stride = (s->nb_components > 1) ? 3 : 1;
431  off = av_clip(s->cur_scan - 1, 0, stride - 1);
432  width = s->width * stride;
433  cur += off;
434  for (i = 0; i < s->height; i++) {
435  int restart;
436  ret = ff_mjpeg_handle_restart(s, &restart);
437  if (ret < 0)
438  goto end;
439  if (restart) {
441  t = 0;
442  last = zero;
443  }
444  if (s->bits <= 8) {
445  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
446  t = last[0];
447  } else {
448  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
449  t = *((uint16_t *)last);
450  }
451  if (ret < 0)
452  break;
453  last = cur;
454  cur += s->picture_ptr->linesize[0];
455  }
456  decoded_height = i;
457  } else if (ilv == 1) { /* line interleaving */
458  int j;
459  int Rc[3] = { 0, 0, 0 };
460  stride = (s->nb_components > 1) ? 3 : 1;
461  memset(cur, 0, s->picture_ptr->linesize[0]);
462  width = s->width * stride;
463  for (i = 0; i < s->height; i++) {
464  int restart;
465  ret = ff_mjpeg_handle_restart(s, &restart);
466  if (ret < 0)
467  goto end;
468  if (restart) {
470  memset(Rc, 0, sizeof(Rc));
471  last = zero;
472  }
473  for (j = 0; j < stride; j++) {
474  ret = ls_decode_line(state, s, last + j, cur + j,
475  Rc[j], width, stride, j, 8);
476  if (ret < 0)
477  break;
478  Rc[j] = last[j];
479  }
480  if (ret < 0)
481  break;
482  last = cur;
483  cur += s->picture_ptr->linesize[0];
484  }
485  decoded_height = i;
486  } else if (ilv == 2) { /* sample interleaving */
487  avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
489  goto end;
490  } else { /* unknown interleaving */
491  avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
493  goto end;
494  }
495 
496  if (s->xfrm && s->nb_components == 3) {
497  int x, w;
498 
499  w = s->width * s->nb_components;
500 
501  if (s->bits <= 8) {
502  uint8_t *src = s->picture_ptr->data[0];
503 
504  for (i = 0; i < s->height; i++) {
505  switch(s->xfrm) {
506  case 1:
507  for (x = off; x + 2 < w; x += 3) {
508  src[x ] += src[x+1] + 128;
509  src[x+2] += src[x+1] + 128;
510  }
511  break;
512  case 2:
513  for (x = off; x + 2 < w; x += 3) {
514  src[x ] += src[x+1] + 128;
515  src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
516  }
517  break;
518  case 3:
519  for (x = off; x + 2 < w; x += 3) {
520  int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
521  src[x+0] = src[x+2] + g + 128;
522  src[x+2] = src[x+1] + g + 128;
523  src[x+1] = g;
524  }
525  break;
526  case 4:
527  for (x = off; x + 2 < w; x += 3) {
528  int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
529  int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
530  int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
531  src[x+0] = av_clip_uint8(r);
532  src[x+1] = av_clip_uint8(g);
533  src[x+2] = av_clip_uint8(b);
534  }
535  break;
536  }
537  src += s->picture_ptr->linesize[0];
538  }
539  }else
540  avpriv_report_missing_feature(s->avctx, "16bit xfrm");
541  }
542 
543  if (shift) { /* we need to do point transform or normalize samples */
544  int x, w;
545 
546  w = s->width * s->nb_components;
547 
548  if (s->bits <= 8) {
549  uint8_t *src = s->picture_ptr->data[0];
550 
551  for (i = 0; i < decoded_height; i++) {
552  for (x = off; x < w; x += stride)
553  src[x] <<= shift;
554  src += s->picture_ptr->linesize[0];
555  }
556  } else {
557  uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
558 
559  for (i = 0; i < decoded_height; i++) {
560  for (x = 0; x < w; x++)
561  src[x] <<= shift;
562  src += s->picture_ptr->linesize[0] / 2;
563  }
564  }
565  }
566 
567 end:
568  av_free(zero);
569 
570  return ret;
571 }
572 
574  .p.name = "jpegls",
575  CODEC_LONG_NAME("JPEG-LS"),
576  .p.type = AVMEDIA_TYPE_VIDEO,
577  .p.id = AV_CODEC_ID_JPEGLS,
578  .priv_data_size = sizeof(MJpegDecodeContext),
582  .p.capabilities = AV_CODEC_CAP_DR1,
583  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
584 };
av_clip
#define av_clip
Definition: common.h:100
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:498
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:688
r
const char * r
Definition: vf_curves.c:127
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
comp
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:79
mjpegdec.h
b
#define b
Definition: input.c:43
jpeglsdec.h
R
#define R
Definition: huffyuv.h:44
FFCodec
Definition: codec_internal.h:127
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
ls_get_code_regular
static int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
Get context-dependent Golomb code, decode it and update context.
Definition: jpeglsdec.c:155
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1387
golomb.h
exp golomb vlc stuff
close
static av_cold void close(AVCodecParserContext *s)
Definition: apv_parser.c:197
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:337
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
ff_mjpeg_decode_init
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
Definition: mjpegdec.c:123
GetBitContext
Definition: get_bits.h:109
JLSState
Definition: jpegls.h:36
ff_mjpeg_handle_restart
static int ff_mjpeg_handle_restart(MJpegDecodeContext *s, int *restart)
Definition: mjpegdec.h:216
Q
#define Q(q)
jpegls.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
get_ur_golomb_jpegls
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
Definition: golomb.h:431
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:347
W
#define W(a, i, v)
Definition: jpegls.h:119
s
#define s(width, name)
Definition: cbs_vp9.c:198
g
const char * g
Definition: vf_curves.c:128
ff_jpegls_decoder
const FFCodec ff_jpegls_decoder
Definition: jpeglsdec.c:573
bits
uint8_t bits
Definition: vp3data.h:128
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:42
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
ls_decode_line
static int ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits)
Decode one line of image.
Definition: jpeglsdec.c:234
get_bits.h
ff_mjpeg_decode_end
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
Definition: mjpegdec.c:2911
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
av_fallthrough
#define av_fallthrough
Definition: attributes.h:67
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:332
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:74
if
if(ret)
Definition: filter_design.txt:179
context
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Definition: writing_filters.txt:91
ff_jpegls_downscale_state
static void ff_jpegls_downscale_state(JLSState *state, int Q)
Definition: jpegls.h:84
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:391
mathops.h
MJpegDecodeContext
Definition: mjpegdec.h:56
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:28
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:551
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
codec_internal.h
ff_jpegls_decode_lse
int ff_jpegls_decode_lse(MJpegDecodeContext *s)
Decode LSE block with initialization parameters.
Definition: jpeglsdec.c:52
shift
static int shift(int a, int b)
Definition: bonk.c:261
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
ff_mjpeg_decode_frame
int ff_mjpeg_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: mjpegdec.c:2901
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:424
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
ff_jpegls_quantize
static int ff_jpegls_quantize(JLSState *s, int v)
Calculate quantized gradient value, used for context determination.
Definition: jpegls.h:52
state
static struct @583 state
attributes.h
zero
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:121
av_malloc
#define av_malloc(s)
Definition: ops_asmgen.c:44
ff_jpegls_init_state
void ff_jpegls_init_state(JLSState *state)
Calculate initial JPEG-LS parameters.
Definition: jpegls.c:34
ff_jpegls_update_state_regular
static int ff_jpegls_update_state_regular(JLSState *state, int Q, int err)
Definition: jpegls.h:94
ff_jpegls_decode_picture
int ff_jpegls_decode_picture(MJpegDecodeContext *s)
Definition: jpeglsdec.c:357
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
len
int len
Definition: vorbis_enc_data.h:426
avcodec.h
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
mid_pred
#define mid_pred
Definition: mathops.h:115
ret
ret
Definition: filter_design.txt:187
pred
static const float pred[4]
Definition: siprdata.h:259
ls_get_code_runterm
static int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RItype, int limit_add)
Get Golomb code, decode it and update state for run termination.
Definition: jpeglsdec.c:186
ff_jpegls_reset_coding_parameters
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
Calculate JPEG-LS codec values.
Definition: jpegls.c:69
id
enum AVCodecID id
Definition: dts2pts.c:550
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:63
temp
else temp
Definition: vf_mcdeint.c:271
av_clip_uint8
#define av_clip_uint8
Definition: common.h:106
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
mem.h
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:37
w
uint8_t w
Definition: llvidencdsp.c:39
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
ff_log2_run
const uint8_t ff_log2_run[41]
Definition: mathtables.c:155
MAX_COMPONENTS
#define MAX_COMPONENTS
Definition: mjpegdec.h:47
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
stride
#define stride
Definition: h264pred_template.c:536
width
#define width
Definition: dsp.h:89
src
#define src
Definition: vp8dsp.c:248