MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ls_get_code_regular

Function ls_get_code_regular

libavcodec/jpeglsdec.c:153–179  ·  view source on GitHub ↗

* Get context-dependent Golomb code, decode it and update context */

Source from the content-addressed store, hash-verified

151 * Get context-dependent Golomb code, decode it and update context
152 */
153static 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
176 ret = ff_jpegls_update_state_regular(state, Q, ret);
177
178 return ret;
179}
180
181/**
182 * Get Golomb code, decode it and update state for run termination

Callers 1

ls_decode_lineFunction · 0.85

Calls 3

show_bits_longFunction · 0.85
get_ur_golomb_jpeglsFunction · 0.85

Tested by

no test coverage detected