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