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/mem.h"
29 #include "avcodec.h"
30 #include "codec_internal.h"
31 #include "get_bits.h"
32 #include "golomb.h"
33 #include "mathops.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; ((unsigned)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  if (ret < 0)
204  return -0x10000;
205 
206  /* decode mapped error */
207  map = 0;
208  if (!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
209  map = 1;
210  ret += RItype + map;
211 
212  if (ret & 1) {
213  ret = map - (ret + 1 >> 1);
214  state->B[Q]++;
215  } else {
216  ret = ret >> 1;
217  }
218 
219  if (FFABS(ret) > 0xFFFF)
220  return -0x10000;
221  /* update state */
222  state->A[Q] += FFABS(ret) - RItype;
223  ret *= state->twonear;
225 
226  return ret;
227 }
228 
229 /**
230  * Decode one line of image
231  */
233  void *last, void *dst, int last2, int w,
234  int stride, int comp, int bits)
235 {
236  int i, x = 0;
237  int Ra, Rb, Rc, Rd;
238  int D0, D1, D2;
239 
240  while (x < w) {
241  int err, pred;
242 
243  if (get_bits_left(&s->gb) <= 0)
244  return AVERROR_INVALIDDATA;
245 
246  /* compute gradients */
247  Ra = x ? R(dst, x - stride) : R(last, x);
248  Rb = R(last, x);
249  Rc = x ? R(last, x - stride) : last2;
250  Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
251  D0 = Rd - Rb;
252  D1 = Rb - Rc;
253  D2 = Rc - Ra;
254  /* run mode */
255  if ((FFABS(D0) <= state->near) &&
256  (FFABS(D1) <= state->near) &&
257  (FFABS(D2) <= state->near)) {
258  int r;
259  int RItype;
260 
261  /* decode full runs while available */
262  while (get_bits1(&s->gb)) {
263  int r;
264  r = 1 << ff_log2_run[state->run_index[comp]];
265  if (x + r * stride > w)
266  r = (w - x) / stride;
267  for (i = 0; i < r; i++) {
268  W(dst, x, Ra);
269  x += stride;
270  }
271  /* if EOL reached, we stop decoding */
272  if (r != 1 << ff_log2_run[state->run_index[comp]])
273  return 0;
274  if (state->run_index[comp] < 31)
275  state->run_index[comp]++;
276  if (x + stride > w)
277  return 0;
278  }
279  /* decode aborted run */
280  r = ff_log2_run[state->run_index[comp]];
281  if (r)
282  r = get_bits(&s->gb, r);
283  if (x + r * stride > w) {
284  r = (w - x) / stride;
285  }
286  for (i = 0; i < r; i++) {
287  W(dst, x, Ra);
288  x += stride;
289  }
290 
291  if (x >= w) {
292  av_log(NULL, AV_LOG_ERROR, "run overflow\n");
293  av_assert0(x <= w);
294  return AVERROR_INVALIDDATA;
295  }
296 
297  /* decode run termination value */
298  Rb = R(last, x);
299  RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
300  err = ls_get_code_runterm(&s->gb, state, RItype,
301  ff_log2_run[state->run_index[comp]]);
302  if (state->run_index[comp])
303  state->run_index[comp]--;
304 
305  if (state->near && RItype) {
306  pred = Ra + err;
307  } else {
308  if (Rb < Ra)
309  pred = Rb - err;
310  else
311  pred = Rb + err;
312  }
313  } else { /* regular mode */
314  int context, sign;
315 
316  context = ff_jpegls_quantize(state, D0) * 81 +
317  ff_jpegls_quantize(state, D1) * 9 +
319  pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
320 
321  if (context < 0) {
322  context = -context;
323  sign = 1;
324  } else {
325  sign = 0;
326  }
327 
328  if (sign) {
329  pred = av_clip(pred - state->C[context], 0, state->maxval);
330  err = -ls_get_code_regular(&s->gb, state, context);
331  } else {
332  pred = av_clip(pred + state->C[context], 0, state->maxval);
333  err = ls_get_code_regular(&s->gb, state, context);
334  }
335 
336  /* we have to do something more for near-lossless coding */
337  pred += err;
338  }
339  if (state->near) {
340  if (pred < -state->near)
341  pred += state->range * state->twonear;
342  else if (pred > state->maxval + state->near)
343  pred -= state->range * state->twonear;
344  pred = av_clip(pred, 0, state->maxval);
345  }
346 
347  pred &= state->maxval;
348  W(dst, x, pred);
349  x += stride;
350  }
351 
352  return 0;
353 }
354 
356  int point_transform, int ilv)
357 {
358  int i, t = 0;
359  uint8_t *zero, *last, *cur;
360  JLSState *state = s->jls_state;
361  int off = 0, stride = 1, width, shift, ret = 0;
362  int decoded_height = 0;
363 
364  if (!state) {
365  state = av_malloc(sizeof(*state));
366  if (!state)
367  return AVERROR(ENOMEM);
368  s->jls_state = state;
369  }
370  zero = av_mallocz(s->picture_ptr->linesize[0]);
371  if (!zero)
372  return AVERROR(ENOMEM);
373  last = zero;
374  cur = s->picture_ptr->data[0];
375 
376  /* initialize JPEG-LS state from JPEG parameters */
377  memset(state, 0, sizeof(*state));
378  state->near = near;
379  state->bpp = (s->bits < 2) ? 2 : s->bits;
380  state->maxval = s->maxval;
381  state->T1 = s->t1;
382  state->T2 = s->t2;
383  state->T3 = s->t3;
384  state->reset = s->reset;
386 
387  /* Testing parameters here, we cannot test in LSE or SOF because
388  * these interdepend and are allowed in either order
389  */
390  if (state->maxval >= (1<<state->bpp) ||
391  state->T1 > state->T2 ||
392  state->T2 > state->T3 ||
393  state->T3 > state->maxval ||
394  state->reset > FFMAX(255, state->maxval)) {
396  goto end;
397  }
398 
400 
401  if (s->bits <= 8)
402  shift = point_transform + (8 - s->bits);
403  else
404  shift = point_transform + (16 - s->bits);
405 
406  if (shift >= 16) {
408  goto end;
409  }
410 
411  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
412  av_log(s->avctx, AV_LOG_DEBUG,
413  "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
414  "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
415  s->width, s->height, state->near, state->maxval,
416  state->T1, state->T2, state->T3,
417  state->reset, state->limit, state->qbpp, state->range);
418  av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
419  ilv, point_transform, s->bits, s->cur_scan);
420  }
421  if (get_bits_left(&s->gb) < s->height) {
423  goto end;
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 ret;
436  if (s->bits <= 8) {
437  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
438  t = last[0];
439  } else {
440  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
441  t = *((uint16_t *)last);
442  }
443  if (ret < 0)
444  break;
445  last = cur;
446  cur += s->picture_ptr->linesize[0];
447 
448  if (s->restart_interval && !--s->restart_count) {
449  align_get_bits(&s->gb);
450  skip_bits(&s->gb, 16); /* skip RSTn */
451  }
452  }
453  decoded_height = i;
454  } else if (ilv == 1) { /* line interleaving */
455  int j;
456  int Rc[3] = { 0, 0, 0 };
457  stride = (s->nb_components > 1) ? 3 : 1;
458  memset(cur, 0, s->picture_ptr->linesize[0]);
459  width = s->width * stride;
460  for (i = 0; i < s->height; i++) {
461  int ret;
462  for (j = 0; j < stride; j++) {
463  ret = ls_decode_line(state, s, last + j, cur + j,
464  Rc[j], width, stride, j, 8);
465  if (ret < 0)
466  break;
467  Rc[j] = last[j];
468 
469  if (s->restart_interval && !--s->restart_count) {
470  align_get_bits(&s->gb);
471  skip_bits(&s->gb, 16); /* skip RSTn */
472  }
473  }
474  if (ret < 0)
475  break;
476  last = cur;
477  cur += s->picture_ptr->linesize[0];
478  }
479  decoded_height = i;
480  } else if (ilv == 2) { /* sample interleaving */
481  avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
483  goto end;
484  } else { /* unknown interleaving */
485  avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
487  goto end;
488  }
489 
490  if (s->xfrm && s->nb_components == 3) {
491  int x, w;
492 
493  w = s->width * s->nb_components;
494 
495  if (s->bits <= 8) {
496  uint8_t *src = s->picture_ptr->data[0];
497 
498  for (i = 0; i < s->height; i++) {
499  switch(s->xfrm) {
500  case 1:
501  for (x = off; x + 2 < w; x += 3) {
502  src[x ] += src[x+1] + 128;
503  src[x+2] += src[x+1] + 128;
504  }
505  break;
506  case 2:
507  for (x = off; x + 2 < w; x += 3) {
508  src[x ] += src[x+1] + 128;
509  src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
510  }
511  break;
512  case 3:
513  for (x = off; x + 2 < w; x += 3) {
514  int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
515  src[x+0] = src[x+2] + g + 128;
516  src[x+2] = src[x+1] + g + 128;
517  src[x+1] = g;
518  }
519  break;
520  case 4:
521  for (x = off; x + 2 < w; x += 3) {
522  int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
523  int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
524  int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
525  src[x+0] = av_clip_uint8(r);
526  src[x+1] = av_clip_uint8(g);
527  src[x+2] = av_clip_uint8(b);
528  }
529  break;
530  }
531  src += s->picture_ptr->linesize[0];
532  }
533  }else
534  avpriv_report_missing_feature(s->avctx, "16bit xfrm");
535  }
536 
537  if (shift) { /* we need to do point transform or normalize samples */
538  int x, w;
539 
540  w = s->width * s->nb_components;
541 
542  if (s->bits <= 8) {
543  uint8_t *src = s->picture_ptr->data[0];
544 
545  for (i = 0; i < decoded_height; i++) {
546  for (x = off; x < w; x += stride)
547  src[x] <<= shift;
548  src += s->picture_ptr->linesize[0];
549  }
550  } else {
551  uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
552 
553  for (i = 0; i < decoded_height; i++) {
554  for (x = 0; x < w; x++)
555  src[x] <<= shift;
556  src += s->picture_ptr->linesize[0] / 2;
557  }
558  }
559  }
560 
561 end:
562  av_free(zero);
563 
564  return ret;
565 }
566 
568  .p.name = "jpegls",
569  CODEC_LONG_NAME("JPEG-LS"),
570  .p.type = AVMEDIA_TYPE_VIDEO,
571  .p.id = AV_CODEC_ID_JPEGLS,
572  .priv_data_size = sizeof(MJpegDecodeContext),
574  .close = ff_mjpeg_decode_end,
576  .p.capabilities = AV_CODEC_CAP_DR1,
577  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
578 };
W
@ W
Definition: vf_addroi.c:27
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:495
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:695
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:81
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:153
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1407
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
state
static struct @464 state
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
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:209
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:311
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:567
ff_jpegls_decode_picture
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
Definition: jpeglsdec.c:355
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:230
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:232
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:296
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: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:368
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:51
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:83
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
zero
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:121
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
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:256
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:96
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: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:367
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:106
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mem.h
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
ff_log2_run
const uint8_t ff_log2_run[41]
Definition: mathtables.c:116
Q
#define Q(x)
Definition: filter_template.c:423
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
width
#define width
Definition: dsp.h:85
src
#define src
Definition: vp8dsp.c:248