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->picture_ptr->format =
122  s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
123  for (i=s->palette_index; i<=maxtab; i++) {
124  uint8_t k = i << shift;
125  pal[k] = wt < 4 ? 0xFF000000 : 0;
126  for (j=0; j<wt; j++) {
127  pal[k] |= get_bits(&s->gb, 8) << (8*(wt-j-1));
128  }
129  }
130  s->palette_index = i;
131  }
132  break;
133  case 4:
134  avpriv_request_sample(s->avctx, "oversize image");
135  return AVERROR(ENOSYS);
136  default:
137  av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
138  return AVERROR_INVALIDDATA;
139  }
140  ff_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
141 
142  return 0;
143 }
144 
145 /**
146  * Get context-dependent Golomb code, decode it and update context
147  */
148 static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
149 {
150  int k, ret;
151 
152  for (k = 0; ((unsigned)state->N[Q] << k) < state->A[Q]; k++)
153  ;
154 
155 #ifdef JLS_BROKEN
156  if (!show_bits_long(gb, 32))
157  return -1;
158 #endif
159  ret = get_ur_golomb_jpegls(gb, k, state->limit, state->qbpp);
160 
161  /* decode mapped error */
162  if (ret & 1)
163  ret = -(ret + 1 >> 1);
164  else
165  ret >>= 1;
166 
167  /* for NEAR=0, k=0 and 2*B[Q] <= - N[Q] mapping is reversed */
168  if (!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
169  ret = -(ret + 1);
170 
172 
173  return ret;
174 }
175 
176 /**
177  * Get Golomb code, decode it and update state for run termination
178  */
180  int RItype, int limit_add)
181 {
182  int k, ret, temp, map;
183  int Q = 365 + RItype;
184 
185  temp = state->A[Q];
186  if (RItype)
187  temp += state->N[Q] >> 1;
188 
189  for (k = 0; ((unsigned)state->N[Q] << k) < temp; k++)
190  ;
191 
192 #ifdef JLS_BROKEN
193  if (!show_bits_long(gb, 32))
194  return -1;
195 #endif
196  ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1,
197  state->qbpp);
198  if (ret < 0)
199  return -0x10000;
200 
201  /* decode mapped error */
202  map = 0;
203  if (!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
204  map = 1;
205  ret += RItype + map;
206 
207  if (ret & 1) {
208  ret = map - (ret + 1 >> 1);
209  state->B[Q]++;
210  } else {
211  ret = ret >> 1;
212  }
213 
214  if (FFABS(ret) > 0xFFFF)
215  return -0x10000;
216  /* update state */
217  state->A[Q] += FFABS(ret) - RItype;
218  ret *= state->twonear;
220 
221  return ret;
222 }
223 
224 /**
225  * Decode one line of image
226  */
228  void *last, void *dst, int last2, int w,
229  int stride, int comp, int bits)
230 {
231  int i, x = 0;
232  int Ra, Rb, Rc, Rd;
233  int D0, D1, D2;
234 
235  while (x < w) {
236  int err, pred;
237 
238  if (get_bits_left(&s->gb) <= 0)
239  return;
240 
241  /* compute gradients */
242  Ra = x ? R(dst, x - stride) : R(last, x);
243  Rb = R(last, x);
244  Rc = x ? R(last, x - stride) : last2;
245  Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
246  D0 = Rd - Rb;
247  D1 = Rb - Rc;
248  D2 = Rc - Ra;
249  /* run mode */
250  if ((FFABS(D0) <= state->near) &&
251  (FFABS(D1) <= state->near) &&
252  (FFABS(D2) <= state->near)) {
253  int r;
254  int RItype;
255 
256  /* decode full runs while available */
257  while (get_bits1(&s->gb)) {
258  int r;
259  r = 1 << ff_log2_run[state->run_index[comp]];
260  if (x + r * stride > w)
261  r = (w - x) / stride;
262  for (i = 0; i < r; i++) {
263  W(dst, x, Ra);
264  x += stride;
265  }
266  /* if EOL reached, we stop decoding */
267  if (r != 1 << ff_log2_run[state->run_index[comp]])
268  return;
269  if (state->run_index[comp] < 31)
270  state->run_index[comp]++;
271  if (x + stride > w)
272  return;
273  }
274  /* decode aborted run */
275  r = ff_log2_run[state->run_index[comp]];
276  if (r)
277  r = get_bits_long(&s->gb, r);
278  if (x + r * stride > w) {
279  r = (w - x) / stride;
280  }
281  for (i = 0; i < r; i++) {
282  W(dst, x, Ra);
283  x += stride;
284  }
285 
286  if (x >= w) {
287  av_log(NULL, AV_LOG_ERROR, "run overflow\n");
288  av_assert0(x <= w);
289  return;
290  }
291 
292  /* decode run termination value */
293  Rb = R(last, x);
294  RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
295  err = ls_get_code_runterm(&s->gb, state, RItype,
296  ff_log2_run[state->run_index[comp]]);
297  if (state->run_index[comp])
298  state->run_index[comp]--;
299 
300  if (state->near && RItype) {
301  pred = Ra + err;
302  } else {
303  if (Rb < Ra)
304  pred = Rb - err;
305  else
306  pred = Rb + err;
307  }
308  } else { /* regular mode */
309  int context, sign;
310 
311  context = ff_jpegls_quantize(state, D0) * 81 +
312  ff_jpegls_quantize(state, D1) * 9 +
314  pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
315 
316  if (context < 0) {
317  context = -context;
318  sign = 1;
319  } else {
320  sign = 0;
321  }
322 
323  if (sign) {
324  pred = av_clip(pred - state->C[context], 0, state->maxval);
325  err = -ls_get_code_regular(&s->gb, state, context);
326  } else {
327  pred = av_clip(pred + state->C[context], 0, state->maxval);
328  err = ls_get_code_regular(&s->gb, state, context);
329  }
330 
331  /* we have to do something more for near-lossless coding */
332  pred += err;
333  }
334  if (state->near) {
335  if (pred < -state->near)
336  pred += state->range * state->twonear;
337  else if (pred > state->maxval + state->near)
338  pred -= state->range * state->twonear;
339  pred = av_clip(pred, 0, state->maxval);
340  }
341 
342  pred &= state->maxval;
343  W(dst, x, pred);
344  x += stride;
345  }
346 }
347 
349  int point_transform, int ilv)
350 {
351  int i, t = 0;
352  uint8_t *zero, *last, *cur;
353  JLSState *state;
354  int off = 0, stride = 1, width, shift, ret = 0;
355 
356  zero = av_mallocz(s->picture_ptr->linesize[0]);
357  if (!zero)
358  return AVERROR(ENOMEM);
359  last = zero;
360  cur = s->picture_ptr->data[0];
361 
362  state = av_mallocz(sizeof(JLSState));
363  if (!state) {
364  av_free(zero);
365  return AVERROR(ENOMEM);
366  }
367  /* initialize JPEG-LS state from JPEG parameters */
368  state->near = near;
369  state->bpp = (s->bits < 2) ? 2 : s->bits;
370  state->maxval = s->maxval;
371  state->T1 = s->t1;
372  state->T2 = s->t2;
373  state->T3 = s->t3;
374  state->reset = s->reset;
377 
378  if (s->bits <= 8)
379  shift = point_transform + (8 - s->bits);
380  else
381  shift = point_transform + (16 - s->bits);
382 
383  if (shift >= 16) {
385  goto end;
386  }
387 
388  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
389  av_log(s->avctx, AV_LOG_DEBUG,
390  "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
391  "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
392  s->width, s->height, state->near, state->maxval,
393  state->T1, state->T2, state->T3,
394  state->reset, state->limit, state->qbpp, state->range);
395  av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
396  ilv, point_transform, s->bits, s->cur_scan);
397  }
398  if (get_bits_left(&s->gb) < s->height) {
400  goto end;
401  }
402  if (ilv == 0) { /* separate planes */
403  if (s->cur_scan > s->nb_components) {
405  goto end;
406  }
407  stride = (s->nb_components > 1) ? 3 : 1;
408  off = av_clip(s->cur_scan - 1, 0, stride - 1);
409  width = s->width * stride;
410  cur += off;
411  for (i = 0; i < s->height; i++) {
412  if (s->bits <= 8) {
413  ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
414  t = last[0];
415  } else {
416  ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
417  t = *((uint16_t *)last);
418  }
419  last = cur;
420  cur += s->picture_ptr->linesize[0];
421 
422  if (s->restart_interval && !--s->restart_count) {
423  align_get_bits(&s->gb);
424  skip_bits(&s->gb, 16); /* skip RSTn */
425  }
426  }
427  } else if (ilv == 1) { /* line interleaving */
428  int j;
429  int Rc[3] = { 0, 0, 0 };
430  stride = (s->nb_components > 1) ? 3 : 1;
431  memset(cur, 0, s->picture_ptr->linesize[0]);
432  width = s->width * stride;
433  for (i = 0; i < s->height; i++) {
434  for (j = 0; j < stride; j++) {
435  ls_decode_line(state, s, last + j, cur + j,
436  Rc[j], width, stride, j, 8);
437  Rc[j] = last[j];
438 
439  if (s->restart_interval && !--s->restart_count) {
440  align_get_bits(&s->gb);
441  skip_bits(&s->gb, 16); /* skip RSTn */
442  }
443  }
444  last = cur;
445  cur += s->picture_ptr->linesize[0];
446  }
447  } else if (ilv == 2) { /* sample interleaving */
448  avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
450  goto end;
451  } else { /* unknown interleaving */
452  avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
454  goto end;
455  }
456 
457  if (s->xfrm && s->nb_components == 3) {
458  int x, w;
459 
460  w = s->width * s->nb_components;
461 
462  if (s->bits <= 8) {
463  uint8_t *src = s->picture_ptr->data[0];
464 
465  for (i = 0; i < s->height; i++) {
466  switch(s->xfrm) {
467  case 1:
468  for (x = off; x < w; x += 3) {
469  src[x ] += src[x+1] + 128;
470  src[x+2] += src[x+1] + 128;
471  }
472  break;
473  case 2:
474  for (x = off; x < w; x += 3) {
475  src[x ] += src[x+1] + 128;
476  src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
477  }
478  break;
479  case 3:
480  for (x = off; x < w; x += 3) {
481  int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
482  src[x+0] = src[x+2] + g + 128;
483  src[x+2] = src[x+1] + g + 128;
484  src[x+1] = g;
485  }
486  break;
487  case 4:
488  for (x = off; x < w; x += 3) {
489  int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
490  int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
491  int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
492  src[x+0] = av_clip_uint8(r);
493  src[x+1] = av_clip_uint8(g);
494  src[x+2] = av_clip_uint8(b);
495  }
496  break;
497  }
498  src += s->picture_ptr->linesize[0];
499  }
500  }else
501  avpriv_report_missing_feature(s->avctx, "16bit xfrm");
502  }
503 
504  if (shift) { /* we need to do point transform or normalize samples */
505  int x, w;
506 
507  w = s->width * s->nb_components;
508 
509  if (s->bits <= 8) {
510  uint8_t *src = s->picture_ptr->data[0];
511 
512  for (i = 0; i < s->height; i++) {
513  for (x = off; x < w; x += stride)
514  src[x] <<= shift;
515  src += s->picture_ptr->linesize[0];
516  }
517  } else {
518  uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
519 
520  for (i = 0; i < s->height; i++) {
521  for (x = 0; x < w; x++)
522  src[x] <<= shift;
523  src += s->picture_ptr->linesize[0] / 2;
524  }
525  }
526  }
527 
528 end:
529  av_free(state);
530  av_free(zero);
531 
532  return ret;
533 }
534 
536  .name = "jpegls",
537  .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
538  .type = AVMEDIA_TYPE_VIDEO,
539  .id = AV_CODEC_ID_JPEGLS,
540  .priv_data_size = sizeof(MJpegDecodeContext),
542  .close = ff_mjpeg_decode_end,
544  .capabilities = AV_CODEC_CAP_DR1,
545  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
546 };
AVCodec
AVCodec.
Definition: avcodec.h:3481
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:40
mjpeg.h
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:602
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
r
const char * r
Definition: vf_curves.c:114
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:83
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
mjpegdec.h
w
uint8_t w
Definition: llviddspenc.c:38
R
#define R
Definition: huffyuvdsp.h:34
internal.h
b
#define b
Definition: input.c:41
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:148
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:2651
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
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:379
ff_mjpeg_decode_init
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
Definition: mjpegdec.c:139
GetBitContext
Definition: get_bits.h:61
JLSState
Definition: jpegls.h:41
src
#define src
Definition: vp8dsp.c:254
jpegls.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
state
static struct @313 state
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
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
width
#define width
W
#define W(a, i, v)
Definition: jpegls.h:124
s
#define s(width, name)
Definition: cbs_vp9.c:257
g
const char * g
Definition: vf_curves.c:115
ff_jpegls_decode_picture
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
Definition: jpeglsdec.c:348
bits
uint8_t bits
Definition: vp3data.h:202
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:197
get_bits.h
ff_mjpeg_decode_end
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
Definition: mjpegdec.c:2748
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:89
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
ff_log2_run
const uint8_t ff_log2_run[41]
Definition: bitstream.c:39
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
mathops.h
MJpegDecodeContext
Definition: mjpegdec.h:46
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() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
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:188
id
enum AVCodecID id
Definition: extract_extradata_bsf.c:329
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:57
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
ff_mjpeg_decode_frame
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: mjpegdec.c:2269
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
ff_jpegls_init_state
void ff_jpegls_init_state(JLSState *state)
Calculate initial JPEG-LS parameters.
Definition: jpegls.c:31
ff_jpegls_update_state_regular
static int ff_jpegls_update_state_regular(JLSState *state, int Q, int err)
Definition: jpegls.h:99
uint8_t
uint8_t
Definition: audio_convert.c:194
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:236
AVCodec::name
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
len
int len
Definition: vorbis_enc_data.h:452
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:179
align_get_bits
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:693
ff_jpegls_reset_coding_parameters
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
Calculate JPEG-LS codec values.
Definition: jpegls.c:62
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: avcodec.h:229
temp
else temp
Definition: vf_mcdeint.c:256
shift
static int shift(int a, int b)
Definition: sonic.c:82
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
zero
#define zero
Definition: regdef.h:64
ls_decode_line
static void 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:227
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:39
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:85
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
MAX_COMPONENTS
#define MAX_COMPONENTS
Definition: mjpegdec.h:44
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:59
ff_jpegls_decoder
AVCodec ff_jpegls_decoder
Definition: jpeglsdec.c:535