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 "avcodec.h"
29 #include "codec_internal.h"
30 #include "get_bits.h"
31 #include "golomb.h"
32 #include "mathops.h"
33 #include "mjpegdec.h"
34 #include "jpegls.h"
35 #include "jpeglsdec.h"
36 
37 /*
38  * Uncomment this to significantly speed up decoding of broken JPEG-LS
39  * (or test broken JPEG-LS decoder) and slow down ordinary decoding a bit.
40  *
41  * There is no Golomb code with length >= 32 bits possible, so check and
42  * avoid situation of 32 zeros, FFmpeg Golomb decoder is painfully slow
43  * on this errors.
44  */
45 //#define JLS_BROKEN
46 
47 /**
48  * Decode LSE block with initialization parameters
49  */
51 {
52  int id;
53  int tid, wt, maxtab, i, j;
54 
55  int len = get_bits(&s->gb, 16);
56  id = get_bits(&s->gb, 8);
57 
58  switch (id) {
59  case 1:
60  if (len < 13)
61  return AVERROR_INVALIDDATA;
62 
63  s->maxval = get_bits(&s->gb, 16);
64  s->t1 = get_bits(&s->gb, 16);
65  s->t2 = get_bits(&s->gb, 16);
66  s->t3 = get_bits(&s->gb, 16);
67  s->reset = get_bits(&s->gb, 16);
68 
69  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
70  av_log(s->avctx, AV_LOG_DEBUG, "Coding parameters maxval:%d T1:%d T2:%d T3:%d reset:%d\n",
71  s->maxval, s->t1, s->t2, s->t3, s->reset);
72  }
73 
74 // ff_jpegls_reset_coding_parameters(s, 0);
75  //FIXME quant table?
76  break;
77  case 2:
78  s->palette_index = 0;
79  case 3:
80  tid= get_bits(&s->gb, 8);
81  wt = get_bits(&s->gb, 8);
82 
83  if (len < 5)
84  return AVERROR_INVALIDDATA;
85 
86  if (wt < 1 || wt > MAX_COMPONENTS) {
87  avpriv_request_sample(s->avctx, "wt %d", wt);
88  return AVERROR_PATCHWELCOME;
89  }
90 
91  if (!s->maxval)
92  maxtab = 255;
93  else if ((5 + wt*(s->maxval+1)) < 65535)
94  maxtab = s->maxval;
95  else
96  maxtab = 65530/wt - 1;
97 
98  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
99  av_log(s->avctx, AV_LOG_DEBUG, "LSE palette %d tid:%d wt:%d maxtab:%d\n", id, tid, wt, maxtab);
100  }
101  if (maxtab >= 256) {
102  avpriv_request_sample(s->avctx, ">8bit palette");
103  return AVERROR_PATCHWELCOME;
104  }
105  maxtab = FFMIN(maxtab, (len - 5) / wt + s->palette_index);
106 
107  if (s->palette_index > maxtab)
108  return AVERROR_INVALIDDATA;
109 
110  if ((s->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || s->avctx->pix_fmt == AV_PIX_FMT_PAL8) &&
111  (s->picture_ptr->format == AV_PIX_FMT_GRAY8 || s->picture_ptr->format == AV_PIX_FMT_PAL8)) {
112  uint32_t *pal = (uint32_t *)s->picture_ptr->data[1];
113  int shift = 0;
114 
115  if (s->avctx->bits_per_raw_sample > 0 && s->avctx->bits_per_raw_sample < 8) {
116  maxtab = FFMIN(maxtab, (1<<s->avctx->bits_per_raw_sample)-1);
117  shift = 8 - s->avctx->bits_per_raw_sample;
118  }
119 
120  s->force_pal8++;
121  if (!pal) {
122  if (s->force_pal8 > 1)
123  return AVERROR_INVALIDDATA;
124  return 1;
125  }
126 
127  for (i=s->palette_index; i<=maxtab; i++) {
128  uint8_t k = i << shift;
129  pal[k] = wt < 4 ? 0xFF000000 : 0;
130  for (j=0; j<wt; j++) {
131  pal[k] |= get_bits(&s->gb, 8) << (8*(wt-j-1));
132  }
133  }
134  s->palette_index = i;
135  }
136  break;
137  case 4:
138  avpriv_request_sample(s->avctx, "oversize image");
139  return AVERROR(ENOSYS);
140  default:
141  av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
142  return AVERROR_INVALIDDATA;
143  }
144  ff_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
145 
146  return 0;
147 }
148 
149 /**
150  * Get context-dependent Golomb code, decode it and update context
151  */
152 static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
153 {
154  int k, ret;
155 
156  for (k = 0; ((unsigned)state->N[Q] << k) < state->A[Q]; k++)
157  ;
158 
159 #ifdef JLS_BROKEN
160  if (!show_bits_long(gb, 32))
161  return -1;
162 #endif
163  ret = get_ur_golomb_jpegls(gb, k, state->limit, state->qbpp);
164 
165  /* decode mapped error */
166  if (ret & 1)
167  ret = -(ret + 1 >> 1);
168  else
169  ret >>= 1;
170 
171  /* for NEAR=0, k=0 and 2*B[Q] <= - N[Q] mapping is reversed */
172  if (!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
173  ret = -(ret + 1);
174 
176 
177  return ret;
178 }
179 
180 /**
181  * Get Golomb code, decode it and update state for run termination
182  */
184  int RItype, int limit_add)
185 {
186  int k, ret, temp, map;
187  int Q = 365 + RItype;
188 
189  temp = state->A[Q];
190  if (RItype)
191  temp += state->N[Q] >> 1;
192 
193  for (k = 0; ((unsigned)state->N[Q] << k) < temp; k++)
194  ;
195 
196 #ifdef JLS_BROKEN
197  if (!show_bits_long(gb, 32))
198  return -1;
199 #endif
200  ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1,
201  state->qbpp);
202  if (ret < 0)
203  return -0x10000;
204 
205  /* decode mapped error */
206  map = 0;
207  if (!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
208  map = 1;
209  ret += RItype + map;
210 
211  if (ret & 1) {
212  ret = map - (ret + 1 >> 1);
213  state->B[Q]++;
214  } else {
215  ret = ret >> 1;
216  }
217 
218  if (FFABS(ret) > 0xFFFF)
219  return -0x10000;
220  /* update state */
221  state->A[Q] += FFABS(ret) - RItype;
222  ret *= state->twonear;
224 
225  return ret;
226 }
227 
228 /**
229  * Decode one line of image
230  */
232  void *last, void *dst, int last2, int w,
233  int stride, int comp, int bits)
234 {
235  int i, x = 0;
236  int Ra, Rb, Rc, Rd;
237  int D0, D1, D2;
238 
239  while (x < w) {
240  int err, pred;
241 
242  if (get_bits_left(&s->gb) <= 0)
243  return AVERROR_INVALIDDATA;
244 
245  /* compute gradients */
246  Ra = x ? R(dst, x - stride) : R(last, x);
247  Rb = R(last, x);
248  Rc = x ? R(last, x - stride) : last2;
249  Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
250  D0 = Rd - Rb;
251  D1 = Rb - Rc;
252  D2 = Rc - Ra;
253  /* run mode */
254  if ((FFABS(D0) <= state->near) &&
255  (FFABS(D1) <= state->near) &&
256  (FFABS(D2) <= state->near)) {
257  int r;
258  int RItype;
259 
260  /* decode full runs while available */
261  while (get_bits1(&s->gb)) {
262  int r;
263  r = 1 << ff_log2_run[state->run_index[comp]];
264  if (x + r * stride > w)
265  r = (w - x) / stride;
266  for (i = 0; i < r; i++) {
267  W(dst, x, Ra);
268  x += stride;
269  }
270  /* if EOL reached, we stop decoding */
271  if (r != 1 << ff_log2_run[state->run_index[comp]])
272  return 0;
273  if (state->run_index[comp] < 31)
274  state->run_index[comp]++;
275  if (x + stride > w)
276  return 0;
277  }
278  /* decode aborted run */
279  r = ff_log2_run[state->run_index[comp]];
280  if (r)
281  r = get_bits(&s->gb, r);
282  if (x + r * stride > w) {
283  r = (w - x) / stride;
284  }
285  for (i = 0; i < r; i++) {
286  W(dst, x, Ra);
287  x += stride;
288  }
289 
290  if (x >= w) {
291  av_log(NULL, AV_LOG_ERROR, "run overflow\n");
292  av_assert0(x <= w);
293  return AVERROR_INVALIDDATA;
294  }
295 
296  /* decode run termination value */
297  Rb = R(last, x);
298  RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
299  err = ls_get_code_runterm(&s->gb, state, RItype,
300  ff_log2_run[state->run_index[comp]]);
301  if (state->run_index[comp])
302  state->run_index[comp]--;
303 
304  if (state->near && RItype) {
305  pred = Ra + err;
306  } else {
307  if (Rb < Ra)
308  pred = Rb - err;
309  else
310  pred = Rb + err;
311  }
312  } else { /* regular mode */
313  int context, sign;
314 
315  context = ff_jpegls_quantize(state, D0) * 81 +
316  ff_jpegls_quantize(state, D1) * 9 +
318  pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
319 
320  if (context < 0) {
321  context = -context;
322  sign = 1;
323  } else {
324  sign = 0;
325  }
326 
327  if (sign) {
328  pred = av_clip(pred - state->C[context], 0, state->maxval);
329  err = -ls_get_code_regular(&s->gb, state, context);
330  } else {
331  pred = av_clip(pred + state->C[context], 0, state->maxval);
332  err = ls_get_code_regular(&s->gb, state, context);
333  }
334 
335  /* we have to do something more for near-lossless coding */
336  pred += err;
337  }
338  if (state->near) {
339  if (pred < -state->near)
340  pred += state->range * state->twonear;
341  else if (pred > state->maxval + state->near)
342  pred -= state->range * state->twonear;
343  pred = av_clip(pred, 0, state->maxval);
344  }
345 
346  pred &= state->maxval;
347  W(dst, x, pred);
348  x += stride;
349  }
350 
351  return 0;
352 }
353 
355  int point_transform, int ilv)
356 {
357  int i, t = 0;
358  uint8_t *zero, *last, *cur;
359  JLSState *state = s->jls_state;
360  int off = 0, stride = 1, width, shift, ret = 0;
361  int decoded_height = 0;
362 
363  if (!state) {
364  state = av_malloc(sizeof(*state));
365  if (!state)
366  return AVERROR(ENOMEM);
367  s->jls_state = state;
368  }
369  zero = av_mallocz(s->picture_ptr->linesize[0]);
370  if (!zero)
371  return AVERROR(ENOMEM);
372  last = zero;
373  cur = s->picture_ptr->data[0];
374 
375  /* initialize JPEG-LS state from JPEG parameters */
376  memset(state, 0, sizeof(*state));
377  state->near = near;
378  state->bpp = (s->bits < 2) ? 2 : s->bits;
379  state->maxval = s->maxval;
380  state->T1 = s->t1;
381  state->T2 = s->t2;
382  state->T3 = s->t3;
383  state->reset = s->reset;
385 
386  /* Testing parameters here, we cannot test in LSE or SOF because
387  * these interdepend and are allowed in either order
388  */
389  if (state->maxval >= (1<<state->bpp) ||
390  state->T1 > state->T2 ||
391  state->T2 > state->T3 ||
392  state->T3 > state->maxval ||
393  state->reset > FFMAX(255, state->maxval)) {
395  goto end;
396  }
397 
399 
400  if (s->bits <= 8)
401  shift = point_transform + (8 - s->bits);
402  else
403  shift = point_transform + (16 - s->bits);
404 
405  if (shift >= 16) {
407  goto end;
408  }
409 
410  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
411  av_log(s->avctx, AV_LOG_DEBUG,
412  "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
413  "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
414  s->width, s->height, state->near, state->maxval,
415  state->T1, state->T2, state->T3,
416  state->reset, state->limit, state->qbpp, state->range);
417  av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
418  ilv, point_transform, s->bits, s->cur_scan);
419  }
420  if (get_bits_left(&s->gb) < s->height) {
422  goto end;
423  }
424  if (ilv == 0) { /* separate planes */
425  if (s->cur_scan > s->nb_components) {
427  goto end;
428  }
429  stride = (s->nb_components > 1) ? 3 : 1;
430  off = av_clip(s->cur_scan - 1, 0, stride - 1);
431  width = s->width * stride;
432  cur += off;
433  for (i = 0; i < s->height; i++) {
434  int ret;
435  if (s->bits <= 8) {
436  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
437  t = last[0];
438  } else {
439  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
440  t = *((uint16_t *)last);
441  }
442  if (ret < 0)
443  break;
444  last = cur;
445  cur += s->picture_ptr->linesize[0];
446 
447  if (s->restart_interval && !--s->restart_count) {
448  align_get_bits(&s->gb);
449  skip_bits(&s->gb, 16); /* skip RSTn */
450  }
451  }
452  decoded_height = i;
453  } else if (ilv == 1) { /* line interleaving */
454  int j;
455  int Rc[3] = { 0, 0, 0 };
456  stride = (s->nb_components > 1) ? 3 : 1;
457  memset(cur, 0, s->picture_ptr->linesize[0]);
458  width = s->width * stride;
459  for (i = 0; i < s->height; i++) {
460  int ret;
461  for (j = 0; j < stride; j++) {
462  ret = ls_decode_line(state, s, last + j, cur + j,
463  Rc[j], width, stride, j, 8);
464  if (ret < 0)
465  break;
466  Rc[j] = last[j];
467 
468  if (s->restart_interval && !--s->restart_count) {
469  align_get_bits(&s->gb);
470  skip_bits(&s->gb, 16); /* skip RSTn */
471  }
472  }
473  if (ret < 0)
474  break;
475  last = cur;
476  cur += s->picture_ptr->linesize[0];
477  }
478  decoded_height = i;
479  } else if (ilv == 2) { /* sample interleaving */
480  avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
482  goto end;
483  } else { /* unknown interleaving */
484  avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
486  goto end;
487  }
488 
489  if (s->xfrm && s->nb_components == 3) {
490  int x, w;
491 
492  w = s->width * s->nb_components;
493 
494  if (s->bits <= 8) {
495  uint8_t *src = s->picture_ptr->data[0];
496 
497  for (i = 0; i < s->height; i++) {
498  switch(s->xfrm) {
499  case 1:
500  for (x = off; x + 2 < w; x += 3) {
501  src[x ] += src[x+1] + 128;
502  src[x+2] += src[x+1] + 128;
503  }
504  break;
505  case 2:
506  for (x = off; x + 2 < w; x += 3) {
507  src[x ] += src[x+1] + 128;
508  src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
509  }
510  break;
511  case 3:
512  for (x = off; x + 2 < w; x += 3) {
513  int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
514  src[x+0] = src[x+2] + g + 128;
515  src[x+2] = src[x+1] + g + 128;
516  src[x+1] = g;
517  }
518  break;
519  case 4:
520  for (x = off; x + 2 < w; x += 3) {
521  int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
522  int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
523  int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
524  src[x+0] = av_clip_uint8(r);
525  src[x+1] = av_clip_uint8(g);
526  src[x+2] = av_clip_uint8(b);
527  }
528  break;
529  }
530  src += s->picture_ptr->linesize[0];
531  }
532  }else
533  avpriv_report_missing_feature(s->avctx, "16bit xfrm");
534  }
535 
536  if (shift) { /* we need to do point transform or normalize samples */
537  int x, w;
538 
539  w = s->width * s->nb_components;
540 
541  if (s->bits <= 8) {
542  uint8_t *src = s->picture_ptr->data[0];
543 
544  for (i = 0; i < decoded_height; i++) {
545  for (x = off; x < w; x += stride)
546  src[x] <<= shift;
547  src += s->picture_ptr->linesize[0];
548  }
549  } else {
550  uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
551 
552  for (i = 0; i < decoded_height; i++) {
553  for (x = 0; x < w; x++)
554  src[x] <<= shift;
555  src += s->picture_ptr->linesize[0] / 2;
556  }
557  }
558  }
559 
560 end:
561  av_free(zero);
562 
563  return ret;
564 }
565 
567  .p.name = "jpegls",
568  CODEC_LONG_NAME("JPEG-LS"),
569  .p.type = AVMEDIA_TYPE_VIDEO,
570  .p.id = AV_CODEC_ID_JPEGLS,
571  .priv_data_size = sizeof(MJpegDecodeContext),
573  .close = ff_mjpeg_decode_end,
575  .p.capabilities = AV_CODEC_CAP_DR1,
576  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
577 };
W
@ W
Definition: vf_addroi.c:27
av_clip
#define av_clip
Definition: common.h:98
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:42
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:495
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:694
r
const char * r
Definition: vf_curves.c:126
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:80
mjpegdec.h
w
uint8_t w
Definition: llviddspenc.c:38
b
#define b
Definition: input.c:41
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:152
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1393
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:381
golomb.h
exp golomb vlc stuff
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:335
Q
#define Q(x)
Definition: vvc_filter_template.c:433
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:124
GetBitContext
Definition: get_bits.h:108
JLSState
Definition: jpegls.h:36
jpegls.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
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:428
width
#define width
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:306
s
#define s(width, name)
Definition: cbs_vp9.c:198
g
const char * g
Definition: vf_curves.c:127
ff_jpegls_decoder
const FFCodec ff_jpegls_decoder
Definition: jpeglsdec.c:566
ff_jpegls_decode_picture
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
Definition: jpeglsdec.c:354
bits
uint8_t bits
Definition: vp3data.h:128
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
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:231
state
static struct @376 state
get_bits.h
ff_mjpeg_decode_end
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
Definition: mjpegdec.c:2934
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
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:388
mathops.h
MJpegDecodeContext
Definition: mjpegdec.h:54
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:365
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:50
shift
static int shift(int a, int b)
Definition: bonk.c:262
ff_mjpeg_decode_frame
int ff_mjpeg_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: mjpegdec.c:2924
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
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
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:245
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
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
len
int len
Definition: vorbis_enc_data.h:426
avcodec.h
stride
#define stride
Definition: h264pred_template.c:537
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:98
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:183
align_get_bits
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:561
ff_jpegls_reset_coding_parameters
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
Calculate JPEG-LS codec values.
Definition: jpegls.c:65
id
enum AVCodecID id
Definition: dts2pts.c:364
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:63
temp
else temp
Definition: vf_mcdeint.c:263
av_clip_uint8
#define av_clip_uint8
Definition: common.h:104
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
zero
#define zero
Definition: regdef.h:64
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
ff_log2_run
const uint8_t ff_log2_run[41]
Definition: mathtables.c:116
MAX_COMPONENTS
#define MAX_COMPONENTS
Definition: mjpegdec.h:45
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