LCOV - code coverage report
Current view: top level - libavcodec - jpeglsdec.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 135 290 46.6 %
Date: 2017-12-16 21:16:39 Functions: 4 5 80.0 %

          Line data    Source code
       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             :  */
      51           0 : int ff_jpegls_decode_lse(MJpegDecodeContext *s)
      52             : {
      53             :     int id;
      54             :     int tid, wt, maxtab, i, j;
      55             : 
      56           0 :     int len = get_bits(&s->gb, 16);
      57           0 :     id = get_bits(&s->gb, 8);
      58             : 
      59           0 :     switch (id) {
      60           0 :     case 1:
      61           0 :         if (len < 13)
      62           0 :             return AVERROR_INVALIDDATA;
      63             : 
      64           0 :         s->maxval = get_bits(&s->gb, 16);
      65           0 :         s->t1     = get_bits(&s->gb, 16);
      66           0 :         s->t2     = get_bits(&s->gb, 16);
      67           0 :         s->t3     = get_bits(&s->gb, 16);
      68           0 :         s->reset  = get_bits(&s->gb, 16);
      69             : 
      70           0 :         if(s->avctx->debug & FF_DEBUG_PICT_INFO) {
      71           0 :             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           0 :         break;
      78           0 :     case 2:
      79           0 :         s->palette_index = 0;
      80           0 :     case 3:
      81           0 :         tid= get_bits(&s->gb, 8);
      82           0 :         wt = get_bits(&s->gb, 8);
      83             : 
      84           0 :         if (len < 5)
      85           0 :             return AVERROR_INVALIDDATA;
      86             : 
      87           0 :         if (wt < 1 || wt > MAX_COMPONENTS) {
      88           0 :             avpriv_request_sample(s->avctx, "wt %d", wt);
      89           0 :             return AVERROR_PATCHWELCOME;
      90             :         }
      91             : 
      92           0 :         if (!s->maxval)
      93           0 :             maxtab = 255;
      94           0 :         else if ((5 + wt*(s->maxval+1)) < 65535)
      95           0 :             maxtab = s->maxval;
      96             :         else
      97           0 :             maxtab = 65530/wt - 1;
      98             : 
      99           0 :         if(s->avctx->debug & FF_DEBUG_PICT_INFO) {
     100           0 :             av_log(s->avctx, AV_LOG_DEBUG, "LSE palette %d tid:%d wt:%d maxtab:%d\n", id, tid, wt, maxtab);
     101             :         }
     102           0 :         if (maxtab >= 256) {
     103           0 :             avpriv_request_sample(s->avctx, ">8bit palette");
     104           0 :             return AVERROR_PATCHWELCOME;
     105             :         }
     106           0 :         maxtab = FFMIN(maxtab, (len - 5) / wt + s->palette_index);
     107             : 
     108           0 :         if (s->palette_index > maxtab)
     109           0 :             return AVERROR_INVALIDDATA;
     110             : 
     111           0 :         if ((s->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || s->avctx->pix_fmt == AV_PIX_FMT_PAL8) &&
     112           0 :             (s->picture_ptr->format == AV_PIX_FMT_GRAY8 || s->picture_ptr->format == AV_PIX_FMT_PAL8)) {
     113           0 :             uint32_t *pal = (uint32_t *)s->picture_ptr->data[1];
     114           0 :             int shift = 0;
     115             : 
     116           0 :             if (s->avctx->bits_per_raw_sample > 0 && s->avctx->bits_per_raw_sample < 8) {
     117           0 :                 maxtab = FFMIN(maxtab, (1<<s->avctx->bits_per_raw_sample)-1);
     118           0 :                 shift = 8 - s->avctx->bits_per_raw_sample;
     119             :             }
     120             : 
     121           0 :             s->picture_ptr->format =
     122           0 :             s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
     123           0 :             for (i=s->palette_index; i<=maxtab; i++) {
     124           0 :                 uint8_t k = i << shift;
     125           0 :                 pal[k] = 0;
     126           0 :                 for (j=0; j<wt; j++) {
     127           0 :                     pal[k] |= get_bits(&s->gb, 8) << (8*(wt-j-1));
     128             :                 }
     129             :             }
     130           0 :             s->palette_index = i;
     131             :         }
     132           0 :         break;
     133           0 :     case 4:
     134           0 :         avpriv_request_sample(s->avctx, "oversize image");
     135           0 :         return AVERROR(ENOSYS);
     136           0 :     default:
     137           0 :         av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
     138           0 :         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           0 :     return 0;
     143             : }
     144             : 
     145             : /**
     146             :  * Get context-dependent Golomb code, decode it and update context
     147             :  */
     148    44233354 : static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
     149             : {
     150             :     int k, ret;
     151             : 
     152    44233354 :     for (k = 0; (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    44233354 :     ret = get_ur_golomb_jpegls(gb, k, state->limit, state->qbpp);
     160             : 
     161             :     /* decode mapped error */
     162    44233354 :     if (ret & 1)
     163    22858672 :         ret = -(ret + 1 >> 1);
     164             :     else
     165    21374682 :         ret >>= 1;
     166             : 
     167             :     /* for NEAR=0, k=0 and 2*B[Q] <= - N[Q] mapping is reversed */
     168    44233354 :     if (!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
     169      661600 :         ret = -(ret + 1);
     170             : 
     171    44233354 :     ret = ff_jpegls_update_state_regular(state, Q, ret);
     172             : 
     173    44233354 :     return ret;
     174             : }
     175             : 
     176             : /**
     177             :  * Get Golomb code, decode it and update state for run termination
     178             :  */
     179      523199 : static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state,
     180             :                                       int RItype, int limit_add)
     181             : {
     182             :     int k, ret, temp, map;
     183      523199 :     int Q = 365 + RItype;
     184             : 
     185      523199 :     temp = state->A[Q];
     186      523199 :     if (RItype)
     187      293114 :         temp += state->N[Q] >> 1;
     188             : 
     189      523199 :     for (k = 0; (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      523199 :     ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1,
     197             :                                state->qbpp);
     198             : 
     199             :     /* decode mapped error */
     200      523199 :     map = 0;
     201      523199 :     if (!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
     202        4044 :         map = 1;
     203      523199 :     ret += RItype + map;
     204             : 
     205      523199 :     if (ret & 1) {
     206      229976 :         ret = map - (ret + 1 >> 1);
     207      229976 :         state->B[Q]++;
     208             :     } else {
     209      293223 :         ret = ret >> 1;
     210             :     }
     211             : 
     212      523199 :     if(FFABS(ret) > 0xFFFF)
     213           0 :         return -0x10000;
     214             :     /* update state */
     215      523199 :     state->A[Q] += FFABS(ret) - RItype;
     216      523199 :     ret         *= state->twonear;
     217      523199 :     ff_jpegls_downscale_state(state, Q);
     218             : 
     219      523199 :     return ret;
     220             : }
     221             : 
     222             : /**
     223             :  * Decode one line of image
     224             :  */
     225      138258 : static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
     226             :                                   void *last, void *dst, int last2, int w,
     227             :                                   int stride, int comp, int bits)
     228             : {
     229      138258 :     int i, x = 0;
     230             :     int Ra, Rb, Rc, Rd;
     231             :     int D0, D1, D2;
     232             : 
     233    45033069 :     while (x < w) {
     234             :         int err, pred;
     235             : 
     236    44762072 :         if (get_bits_left(&s->gb) <= 0)
     237           0 :             return;
     238             : 
     239             :         /* compute gradients */
     240    44762072 :         Ra = x ? R(dst, x - stride) : R(last, x);
     241    44762072 :         Rb = R(last, x);
     242    44762072 :         Rc = x ? R(last, x - stride) : last2;
     243    44762072 :         Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
     244    44762072 :         D0 = Rd - Rb;
     245    44762072 :         D1 = Rb - Rc;
     246    44762072 :         D2 = Rc - Ra;
     247             :         /* run mode */
     248    49536608 :         if ((FFABS(D0) <= state->near) &&
     249     6438146 :             (FFABS(D1) <= state->near) &&
     250     2186809 :             (FFABS(D2) <= state->near)) {
     251             :             int r;
     252             :             int RItype;
     253             : 
     254             :             /* decode full runs while available */
     255     1533926 :             while (get_bits1(&s->gb)) {
     256             :                 int r;
     257      482009 :                 r = 1 << ff_log2_run[state->run_index[comp]];
     258      482009 :                 if (x + r * stride > w)
     259        4290 :                     r = (w - x) / stride;
     260     2099605 :                 for (i = 0; i < r; i++) {
     261     1617596 :                     W(dst, x, Ra);
     262     1617596 :                     x += stride;
     263             :                 }
     264             :                 /* if EOL reached, we stop decoding */
     265      482009 :                 if (r != 1 << ff_log2_run[state->run_index[comp]])
     266        4290 :                     return;
     267      477719 :                 if (state->run_index[comp] < 31)
     268      477719 :                     state->run_index[comp]++;
     269      477719 :                 if (x + stride > w)
     270        1229 :                     return;
     271             :             }
     272             :             /* decode aborted run */
     273      523199 :             r = ff_log2_run[state->run_index[comp]];
     274      523199 :             if (r)
     275      423893 :                 r = get_bits_long(&s->gb, r);
     276      523199 :             if (x + r * stride > w) {
     277           0 :                 r = (w - x) / stride;
     278             :             }
     279     1161630 :             for (i = 0; i < r; i++) {
     280      638431 :                 W(dst, x, Ra);
     281      638431 :                 x += stride;
     282             :             }
     283             : 
     284      523199 :             if (x >= w) {
     285           0 :                 av_log(NULL, AV_LOG_ERROR, "run overflow\n");
     286           0 :                 av_assert0(x <= w);
     287           0 :                 return;
     288             :             }
     289             : 
     290             :             /* decode run termination value */
     291      523199 :             Rb     = R(last, x);
     292      523199 :             RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
     293      523199 :             err    = ls_get_code_runterm(&s->gb, state, RItype,
     294      523199 :                                          ff_log2_run[state->run_index[comp]]);
     295      523199 :             if (state->run_index[comp])
     296      475644 :                 state->run_index[comp]--;
     297             : 
     298      523199 :             if (state->near && RItype) {
     299           0 :                 pred = Ra + err;
     300             :             } else {
     301      523199 :                 if (Rb < Ra)
     302      148709 :                     pred = Rb - err;
     303             :                 else
     304      374490 :                     pred = Rb + err;
     305             :             }
     306             :         } else { /* regular mode */
     307             :             int context, sign;
     308             : 
     309   132700062 :             context = ff_jpegls_quantize(state, D0) * 81 +
     310    44233354 :                       ff_jpegls_quantize(state, D1) *  9 +
     311    44233354 :                       ff_jpegls_quantize(state, D2);
     312    44233354 :             pred    = mid_pred(Ra, Ra + Rb - Rc, Rb);
     313             : 
     314    44233354 :             if (context < 0) {
     315    17897505 :                 context = -context;
     316    17897505 :                 sign    = 1;
     317             :             } else {
     318    26335849 :                 sign = 0;
     319             :             }
     320             : 
     321    44233354 :             if (sign) {
     322    17897505 :                 pred = av_clip(pred - state->C[context], 0, state->maxval);
     323    17897505 :                 err  = -ls_get_code_regular(&s->gb, state, context);
     324             :             } else {
     325    26335849 :                 pred = av_clip(pred + state->C[context], 0, state->maxval);
     326    26335849 :                 err  = ls_get_code_regular(&s->gb, state, context);
     327             :             }
     328             : 
     329             :             /* we have to do something more for near-lossless coding */
     330    44233354 :             pred += err;
     331             :         }
     332    44756553 :         if (state->near) {
     333           0 :             if (pred < -state->near)
     334           0 :                 pred += state->range * state->twonear;
     335           0 :             else if (pred > state->maxval + state->near)
     336           0 :                 pred -= state->range * state->twonear;
     337           0 :             pred = av_clip(pred, 0, state->maxval);
     338             :         }
     339             : 
     340    44756553 :         pred &= state->maxval;
     341    44756553 :         W(dst, x, pred);
     342    44756553 :         x += stride;
     343             :     }
     344             : }
     345             : 
     346         205 : int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
     347             :                              int point_transform, int ilv)
     348             : {
     349         205 :     int i, t = 0;
     350             :     uint8_t *zero, *last, *cur;
     351             :     JLSState *state;
     352         205 :     int off = 0, stride = 1, width, shift, ret = 0;
     353             : 
     354         205 :     zero = av_mallocz(s->picture_ptr->linesize[0]);
     355         205 :     if (!zero)
     356           0 :         return AVERROR(ENOMEM);
     357         205 :     last = zero;
     358         205 :     cur  = s->picture_ptr->data[0];
     359             : 
     360         205 :     state = av_mallocz(sizeof(JLSState));
     361         205 :     if (!state) {
     362           0 :         av_free(zero);
     363           0 :         return AVERROR(ENOMEM);
     364             :     }
     365             :     /* initialize JPEG-LS state from JPEG parameters */
     366         205 :     state->near   = near;
     367         205 :     state->bpp    = (s->bits < 2) ? 2 : s->bits;
     368         205 :     state->maxval = s->maxval;
     369         205 :     state->T1     = s->t1;
     370         205 :     state->T2     = s->t2;
     371         205 :     state->T3     = s->t3;
     372         205 :     state->reset  = s->reset;
     373         205 :     ff_jpegls_reset_coding_parameters(state, 0);
     374         205 :     ff_jpegls_init_state(state);
     375             : 
     376         205 :     if (s->bits <= 8)
     377         205 :         shift = point_transform + (8 - s->bits);
     378             :     else
     379           0 :         shift = point_transform + (16 - s->bits);
     380             : 
     381         205 :     if (shift >= 16) {
     382           0 :         ret = AVERROR_INVALIDDATA;
     383           0 :         goto end;
     384             :     }
     385             : 
     386         205 :     if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
     387           0 :         av_log(s->avctx, AV_LOG_DEBUG,
     388             :                "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
     389             :                "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
     390             :                 s->width, s->height, state->near, state->maxval,
     391             :                 state->T1, state->T2, state->T3,
     392             :                 state->reset, state->limit, state->qbpp, state->range);
     393           0 :         av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
     394             :                 ilv, point_transform, s->bits, s->cur_scan);
     395             :     }
     396         205 :     if (get_bits_left(&s->gb) < s->height) {
     397           0 :         ret = AVERROR_INVALIDDATA;
     398           0 :         goto end;
     399             :     }
     400         205 :     if (ilv == 0) { /* separate planes */
     401           0 :         if (s->cur_scan > s->nb_components) {
     402           0 :             ret = AVERROR_INVALIDDATA;
     403           0 :             goto end;
     404             :         }
     405           0 :         stride = (s->nb_components > 1) ? 3 : 1;
     406           0 :         off    = av_clip(s->cur_scan - 1, 0, stride - 1);
     407           0 :         width  = s->width * stride;
     408           0 :         cur   += off;
     409           0 :         for (i = 0; i < s->height; i++) {
     410           0 :             if (s->bits <= 8) {
     411           0 :                 ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
     412           0 :                 t = last[0];
     413             :             } else {
     414           0 :                 ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
     415           0 :                 t = *((uint16_t *)last);
     416             :             }
     417           0 :             last = cur;
     418           0 :             cur += s->picture_ptr->linesize[0];
     419             : 
     420           0 :             if (s->restart_interval && !--s->restart_count) {
     421           0 :                 align_get_bits(&s->gb);
     422           0 :                 skip_bits(&s->gb, 16); /* skip RSTn */
     423             :             }
     424             :         }
     425         205 :     } else if (ilv == 1) { /* line interleaving */
     426             :         int j;
     427         205 :         int Rc[3] = { 0, 0, 0 };
     428         205 :         stride = (s->nb_components > 1) ? 3 : 1;
     429         205 :         memset(cur, 0, s->picture_ptr->linesize[0]);
     430         205 :         width = s->width * stride;
     431       46291 :         for (i = 0; i < s->height; i++) {
     432      184344 :             for (j = 0; j < stride; j++) {
     433      138258 :                 ls_decode_line(state, s, last + j, cur + j,
     434             :                                Rc[j], width, stride, j, 8);
     435      138258 :                 Rc[j] = last[j];
     436             : 
     437      138258 :                 if (s->restart_interval && !--s->restart_count) {
     438           0 :                     align_get_bits(&s->gb);
     439           0 :                     skip_bits(&s->gb, 16); /* skip RSTn */
     440             :                 }
     441             :             }
     442       46086 :             last = cur;
     443       46086 :             cur += s->picture_ptr->linesize[0];
     444             :         }
     445           0 :     } else if (ilv == 2) { /* sample interleaving */
     446           0 :         avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
     447           0 :         ret = AVERROR_PATCHWELCOME;
     448           0 :         goto end;
     449             :     } else { /* unknown interleaving */
     450           0 :         avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
     451           0 :         ret = AVERROR_PATCHWELCOME;
     452           0 :         goto end;
     453             :     }
     454             : 
     455         205 :     if (s->xfrm && s->nb_components == 3) {
     456             :         int x, w;
     457             : 
     458           0 :         w = s->width * s->nb_components;
     459             : 
     460           0 :         if (s->bits <= 8) {
     461           0 :             uint8_t *src = s->picture_ptr->data[0];
     462             : 
     463           0 :             for (i = 0; i < s->height; i++) {
     464           0 :                 switch(s->xfrm) {
     465           0 :                 case 1:
     466           0 :                     for (x = off; x < w; x += 3) {
     467           0 :                         src[x  ] += src[x+1] + 128;
     468           0 :                         src[x+2] += src[x+1] + 128;
     469             :                     }
     470           0 :                     break;
     471           0 :                 case 2:
     472           0 :                     for (x = off; x < w; x += 3) {
     473           0 :                         src[x  ] += src[x+1] + 128;
     474           0 :                         src[x+2] += ((src[x  ] + src[x+1])>>1) + 128;
     475             :                     }
     476           0 :                     break;
     477           0 :                 case 3:
     478           0 :                     for (x = off; x < w; x += 3) {
     479           0 :                         int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
     480           0 :                         src[x+0] = src[x+2] + g + 128;
     481           0 :                         src[x+2] = src[x+1] + g + 128;
     482           0 :                         src[x+1] = g;
     483             :                     }
     484           0 :                     break;
     485           0 :                 case 4:
     486           0 :                     for (x = off; x < w; x += 3) {
     487           0 :                         int r    = src[x+0] - ((                       359 * (src[x+2]-128) + 490) >> 8);
     488           0 :                         int g    = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) +  30) >> 8);
     489           0 :                         int b    = src[x+0] + ((454 * (src[x+1]-128)                        + 574) >> 8);
     490           0 :                         src[x+0] = av_clip_uint8(r);
     491           0 :                         src[x+1] = av_clip_uint8(g);
     492           0 :                         src[x+2] = av_clip_uint8(b);
     493             :                     }
     494           0 :                     break;
     495             :                 }
     496           0 :                 src += s->picture_ptr->linesize[0];
     497             :             }
     498             :         }else
     499           0 :             avpriv_report_missing_feature(s->avctx, "16bit xfrm");
     500             :     }
     501             : 
     502         205 :     if (shift) { /* we need to do point transform or normalize samples */
     503             :         int x, w;
     504             : 
     505           0 :         w = s->width * s->nb_components;
     506             : 
     507           0 :         if (s->bits <= 8) {
     508           0 :             uint8_t *src = s->picture_ptr->data[0];
     509             : 
     510           0 :             for (i = 0; i < s->height; i++) {
     511           0 :                 for (x = off; x < w; x += stride)
     512           0 :                     src[x] <<= shift;
     513           0 :                 src += s->picture_ptr->linesize[0];
     514             :             }
     515             :         } else {
     516           0 :             uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
     517             : 
     518           0 :             for (i = 0; i < s->height; i++) {
     519           0 :                 for (x = 0; x < w; x++)
     520           0 :                     src[x] <<= shift;
     521           0 :                 src += s->picture_ptr->linesize[0] / 2;
     522             :             }
     523             :         }
     524             :     }
     525             : 
     526         205 : end:
     527         205 :     av_free(state);
     528         205 :     av_free(zero);
     529             : 
     530         205 :     return ret;
     531             : }
     532             : 
     533             : AVCodec ff_jpegls_decoder = {
     534             :     .name           = "jpegls",
     535             :     .long_name      = NULL_IF_CONFIG_SMALL("JPEG-LS"),
     536             :     .type           = AVMEDIA_TYPE_VIDEO,
     537             :     .id             = AV_CODEC_ID_JPEGLS,
     538             :     .priv_data_size = sizeof(MJpegDecodeContext),
     539             :     .init           = ff_mjpeg_decode_init,
     540             :     .close          = ff_mjpeg_decode_end,
     541             :     .decode         = ff_mjpeg_decode_frame,
     542             :     .capabilities   = AV_CODEC_CAP_DR1,
     543             :     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
     544             : };

Generated by: LCOV version 1.13