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;
386 
387  if (s->bits <= 8)
388  shift = point_transform + (8 - s->bits);
389  else
390  shift = point_transform + (16 - s->bits);
391 
392  if (shift >= 16) {
394  goto end;
395  }
396 
397  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
398  av_log(s->avctx, AV_LOG_DEBUG,
399  "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
400  "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
401  s->width, s->height, state->near, state->maxval,
402  state->T1, state->T2, state->T3,
403  state->reset, state->limit, state->qbpp, state->range);
404  av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
405  ilv, point_transform, s->bits, s->cur_scan);
406  }
407  if (get_bits_left(&s->gb) < s->height) {
409  goto end;
410  }
411  if (ilv == 0) { /* separate planes */
412  if (s->cur_scan > s->nb_components) {
414  goto end;
415  }
416  stride = (s->nb_components > 1) ? 3 : 1;
417  off = av_clip(s->cur_scan - 1, 0, stride - 1);
418  width = s->width * stride;
419  cur += off;
420  for (i = 0; i < s->height; i++) {
421  int ret;
422  if (s->bits <= 8) {
423  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
424  t = last[0];
425  } else {
426  ret = ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
427  t = *((uint16_t *)last);
428  }
429  if (ret < 0)
430  break;
431  last = cur;
432  cur += s->picture_ptr->linesize[0];
433 
434  if (s->restart_interval && !--s->restart_count) {
435  align_get_bits(&s->gb);
436  skip_bits(&s->gb, 16); /* skip RSTn */
437  }
438  }
439  decoded_height = i;
440  } else if (ilv == 1) { /* line interleaving */
441  int j;
442  int Rc[3] = { 0, 0, 0 };
443  stride = (s->nb_components > 1) ? 3 : 1;
444  memset(cur, 0, s->picture_ptr->linesize[0]);
445  width = s->width * stride;
446  for (i = 0; i < s->height; i++) {
447  int ret;
448  for (j = 0; j < stride; j++) {
449  ret = ls_decode_line(state, s, last + j, cur + j,
450  Rc[j], width, stride, j, 8);
451  if (ret < 0)
452  break;
453  Rc[j] = last[j];
454 
455  if (s->restart_interval && !--s->restart_count) {
456  align_get_bits(&s->gb);
457  skip_bits(&s->gb, 16); /* skip RSTn */
458  }
459  }
460  if (ret < 0)
461  break;
462  last = cur;
463  cur += s->picture_ptr->linesize[0];
464  }
465  decoded_height = i;
466  } else if (ilv == 2) { /* sample interleaving */
467  avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
469  goto end;
470  } else { /* unknown interleaving */
471  avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
473  goto end;
474  }
475 
476  if (s->xfrm && s->nb_components == 3) {
477  int x, w;
478 
479  w = s->width * s->nb_components;
480 
481  if (s->bits <= 8) {
482  uint8_t *src = s->picture_ptr->data[0];
483 
484  for (i = 0; i < s->height; i++) {
485  switch(s->xfrm) {
486  case 1:
487  for (x = off; x + 2 < w; x += 3) {
488  src[x ] += src[x+1] + 128;
489  src[x+2] += src[x+1] + 128;
490  }
491  break;
492  case 2:
493  for (x = off; x + 2 < w; x += 3) {
494  src[x ] += src[x+1] + 128;
495  src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
496  }
497  break;
498  case 3:
499  for (x = off; x + 2 < w; x += 3) {
500  int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
501  src[x+0] = src[x+2] + g + 128;
502  src[x+2] = src[x+1] + g + 128;
503  src[x+1] = g;
504  }
505  break;
506  case 4:
507  for (x = off; x + 2 < w; x += 3) {
508  int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
509  int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
510  int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
511  src[x+0] = av_clip_uint8(r);
512  src[x+1] = av_clip_uint8(g);
513  src[x+2] = av_clip_uint8(b);
514  }
515  break;
516  }
517  src += s->picture_ptr->linesize[0];
518  }
519  }else
520  avpriv_report_missing_feature(s->avctx, "16bit xfrm");
521  }
522 
523  if (shift) { /* we need to do point transform or normalize samples */
524  int x, w;
525 
526  w = s->width * s->nb_components;
527 
528  if (s->bits <= 8) {
529  uint8_t *src = s->picture_ptr->data[0];
530 
531  for (i = 0; i < decoded_height; i++) {
532  for (x = off; x < w; x += stride)
533  src[x] <<= shift;
534  src += s->picture_ptr->linesize[0];
535  }
536  } else {
537  uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
538 
539  for (i = 0; i < decoded_height; i++) {
540  for (x = 0; x < w; x++)
541  src[x] <<= shift;
542  src += s->picture_ptr->linesize[0] / 2;
543  }
544  }
545  }
546 
547 end:
548  av_free(zero);
549 
550  return ret;
551 }
552 
554  .p.name = "jpegls",
555  CODEC_LONG_NAME("JPEG-LS"),
556  .p.type = AVMEDIA_TYPE_VIDEO,
557  .p.id = AV_CODEC_ID_JPEGLS,
558  .priv_data_size = sizeof(MJpegDecodeContext),
560  .close = ff_mjpeg_decode_end,
562  .p.capabilities = AV_CODEC_CAP_DR1,
563  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
564 };
av_clip
#define av_clip
Definition: common.h:95
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:474
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:664
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
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:1359
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:371
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:325
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:122
GetBitContext
Definition: get_bits.h:107
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:256
g
const char * g
Definition: vf_curves.c:127
ff_jpegls_decoder
const FFCodec ff_jpegls_decoder
Definition: jpeglsdec.c:553
ff_jpegls_decode_picture
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
Definition: jpeglsdec.c:354
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
bits
uint8_t bits
Definition: vp3data.h:128
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:231
get_bits.h
ff_mjpeg_decode_end
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
Definition: mjpegdec.c:2882
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:64
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:378
mathops.h
MJpegDecodeContext
Definition: mjpegdec.h:54
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:28
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:257
ff_mjpeg_decode_frame
int ff_mjpeg_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: mjpegdec.c:2872
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:269
ff_jpegls_init_state
void ff_jpegls_init_state(JLSState *state)
Calculate initial JPEG-LS parameters.
Definition: jpegls.c:33
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:191
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:77
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:540
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
id
enum AVCodecID id
Definition: dts2pts_bsf.c:364
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:63
W
@ W
Definition: vf_addroi.c:26
temp
else temp
Definition: vf_mcdeint.c:248
av_clip_uint8
#define av_clip_uint8
Definition: common.h:101
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
state
static struct @345 state