annotate ffmpeg/libavcodec/golomb.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * exp golomb vlc stuff
yading@10 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
yading@10 4 * Copyright (c) 2004 Alex Beregszaszi
yading@10 5 *
yading@10 6 * This file is part of FFmpeg.
yading@10 7 *
yading@10 8 * FFmpeg is free software; you can redistribute it and/or
yading@10 9 * modify it under the terms of the GNU Lesser General Public
yading@10 10 * License as published by the Free Software Foundation; either
yading@10 11 * version 2.1 of the License, or (at your option) any later version.
yading@10 12 *
yading@10 13 * FFmpeg is distributed in the hope that it will be useful,
yading@10 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 16 * Lesser General Public License for more details.
yading@10 17 *
yading@10 18 * You should have received a copy of the GNU Lesser General Public
yading@10 19 * License along with FFmpeg; if not, write to the Free Software
yading@10 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 21 */
yading@10 22
yading@10 23 /**
yading@10 24 * @file
yading@10 25 * @brief
yading@10 26 * exp golomb vlc stuff
yading@10 27 * @author Michael Niedermayer <michaelni@gmx.at> and Alex Beregszaszi
yading@10 28 */
yading@10 29
yading@10 30 #ifndef AVCODEC_GOLOMB_H
yading@10 31 #define AVCODEC_GOLOMB_H
yading@10 32
yading@10 33 #include <stdint.h>
yading@10 34 #include "get_bits.h"
yading@10 35 #include "put_bits.h"
yading@10 36
yading@10 37 #define INVALID_VLC 0x80000000
yading@10 38
yading@10 39 extern const uint8_t ff_golomb_vlc_len[512];
yading@10 40 extern const uint8_t ff_ue_golomb_vlc_code[512];
yading@10 41 extern const int8_t ff_se_golomb_vlc_code[512];
yading@10 42 extern const uint8_t ff_ue_golomb_len[256];
yading@10 43
yading@10 44 extern const uint8_t ff_interleaved_golomb_vlc_len[256];
yading@10 45 extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256];
yading@10 46 extern const int8_t ff_interleaved_se_golomb_vlc_code[256];
yading@10 47 extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
yading@10 48
yading@10 49
yading@10 50 /**
yading@10 51 * read unsigned exp golomb code.
yading@10 52 */
yading@10 53 static inline int get_ue_golomb(GetBitContext *gb){
yading@10 54 unsigned int buf;
yading@10 55 int log;
yading@10 56
yading@10 57 OPEN_READER(re, gb);
yading@10 58 UPDATE_CACHE(re, gb);
yading@10 59 buf=GET_CACHE(re, gb);
yading@10 60
yading@10 61 if(buf >= (1<<27)){
yading@10 62 buf >>= 32 - 9;
yading@10 63 LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
yading@10 64 CLOSE_READER(re, gb);
yading@10 65
yading@10 66 return ff_ue_golomb_vlc_code[buf];
yading@10 67 }else{
yading@10 68 log= 2*av_log2(buf) - 31;
yading@10 69 LAST_SKIP_BITS(re, gb, 32 - log);
yading@10 70 CLOSE_READER(re, gb);
yading@10 71 if (CONFIG_FTRAPV && log < 0) {
yading@10 72 av_log(0, AV_LOG_ERROR, "Invalid UE golomb code\n");
yading@10 73 return AVERROR_INVALIDDATA;
yading@10 74 }
yading@10 75 buf>>= log;
yading@10 76 buf--;
yading@10 77
yading@10 78 return buf;
yading@10 79 }
yading@10 80 }
yading@10 81
yading@10 82 /**
yading@10 83 * Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
yading@10 84 */
yading@10 85 static inline unsigned get_ue_golomb_long(GetBitContext *gb)
yading@10 86 {
yading@10 87 unsigned buf, log;
yading@10 88
yading@10 89 buf = show_bits_long(gb, 32);
yading@10 90 log = 31 - av_log2(buf);
yading@10 91 skip_bits_long(gb, log);
yading@10 92
yading@10 93 return get_bits_long(gb, log + 1) - 1;
yading@10 94 }
yading@10 95
yading@10 96 /**
yading@10 97 * read unsigned exp golomb code, constraint to a max of 31.
yading@10 98 * the return value is undefined if the stored value exceeds 31.
yading@10 99 */
yading@10 100 static inline int get_ue_golomb_31(GetBitContext *gb){
yading@10 101 unsigned int buf;
yading@10 102
yading@10 103 OPEN_READER(re, gb);
yading@10 104 UPDATE_CACHE(re, gb);
yading@10 105 buf=GET_CACHE(re, gb);
yading@10 106
yading@10 107 buf >>= 32 - 9;
yading@10 108 LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
yading@10 109 CLOSE_READER(re, gb);
yading@10 110
yading@10 111 return ff_ue_golomb_vlc_code[buf];
yading@10 112 }
yading@10 113
yading@10 114 static inline unsigned svq3_get_ue_golomb(GetBitContext *gb)
yading@10 115 {
yading@10 116 uint32_t buf;
yading@10 117
yading@10 118 OPEN_READER(re, gb);
yading@10 119 UPDATE_CACHE(re, gb);
yading@10 120 buf=GET_CACHE(re, gb);
yading@10 121
yading@10 122 if(buf&0xAA800000){
yading@10 123 buf >>= 32 - 8;
yading@10 124 LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
yading@10 125 CLOSE_READER(re, gb);
yading@10 126
yading@10 127 return ff_interleaved_ue_golomb_vlc_code[buf];
yading@10 128 }else{
yading@10 129 unsigned ret = 1;
yading@10 130
yading@10 131 do {
yading@10 132 buf >>= 32 - 8;
yading@10 133 LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
yading@10 134
yading@10 135 if (ff_interleaved_golomb_vlc_len[buf] != 9){
yading@10 136 ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
yading@10 137 ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
yading@10 138 break;
yading@10 139 }
yading@10 140 ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
yading@10 141 UPDATE_CACHE(re, gb);
yading@10 142 buf = GET_CACHE(re, gb);
yading@10 143 } while (ret<0x8000000U && HAVE_BITS_REMAINING(re, gb));
yading@10 144
yading@10 145 CLOSE_READER(re, gb);
yading@10 146 return ret - 1;
yading@10 147 }
yading@10 148 }
yading@10 149
yading@10 150 /**
yading@10 151 * read unsigned truncated exp golomb code.
yading@10 152 */
yading@10 153 static inline int get_te0_golomb(GetBitContext *gb, int range){
yading@10 154 av_assert2(range >= 1);
yading@10 155
yading@10 156 if(range==1) return 0;
yading@10 157 else if(range==2) return get_bits1(gb)^1;
yading@10 158 else return get_ue_golomb(gb);
yading@10 159 }
yading@10 160
yading@10 161 /**
yading@10 162 * read unsigned truncated exp golomb code.
yading@10 163 */
yading@10 164 static inline int get_te_golomb(GetBitContext *gb, int range){
yading@10 165 av_assert2(range >= 1);
yading@10 166
yading@10 167 if(range==2) return get_bits1(gb)^1;
yading@10 168 else return get_ue_golomb(gb);
yading@10 169 }
yading@10 170
yading@10 171
yading@10 172 /**
yading@10 173 * read signed exp golomb code.
yading@10 174 */
yading@10 175 static inline int get_se_golomb(GetBitContext *gb){
yading@10 176 unsigned int buf;
yading@10 177 int log;
yading@10 178
yading@10 179 OPEN_READER(re, gb);
yading@10 180 UPDATE_CACHE(re, gb);
yading@10 181 buf=GET_CACHE(re, gb);
yading@10 182
yading@10 183 if(buf >= (1<<27)){
yading@10 184 buf >>= 32 - 9;
yading@10 185 LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
yading@10 186 CLOSE_READER(re, gb);
yading@10 187
yading@10 188 return ff_se_golomb_vlc_code[buf];
yading@10 189 }else{
yading@10 190 log = av_log2(buf);
yading@10 191 LAST_SKIP_BITS(re, gb, 31 - log);
yading@10 192 UPDATE_CACHE(re, gb);
yading@10 193 buf = GET_CACHE(re, gb);
yading@10 194
yading@10 195 buf>>= log;
yading@10 196
yading@10 197 LAST_SKIP_BITS(re, gb, 32 - log);
yading@10 198 CLOSE_READER(re, gb);
yading@10 199
yading@10 200 if(buf&1) buf= -(buf>>1);
yading@10 201 else buf= (buf>>1);
yading@10 202
yading@10 203 return buf;
yading@10 204 }
yading@10 205 }
yading@10 206
yading@10 207 static inline int svq3_get_se_golomb(GetBitContext *gb){
yading@10 208 unsigned int buf;
yading@10 209 int log;
yading@10 210
yading@10 211 OPEN_READER(re, gb);
yading@10 212 UPDATE_CACHE(re, gb);
yading@10 213 buf=GET_CACHE(re, gb);
yading@10 214
yading@10 215 if(buf&0xAA800000){
yading@10 216 buf >>= 32 - 8;
yading@10 217 LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
yading@10 218 CLOSE_READER(re, gb);
yading@10 219
yading@10 220 return ff_interleaved_se_golomb_vlc_code[buf];
yading@10 221 }else{
yading@10 222 LAST_SKIP_BITS(re, gb, 8);
yading@10 223 UPDATE_CACHE(re, gb);
yading@10 224 buf |= 1 | (GET_CACHE(re, gb) >> 8);
yading@10 225
yading@10 226 if((buf & 0xAAAAAAAA) == 0)
yading@10 227 return INVALID_VLC;
yading@10 228
yading@10 229 for(log=31; (buf & 0x80000000) == 0; log--){
yading@10 230 buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
yading@10 231 }
yading@10 232
yading@10 233 LAST_SKIP_BITS(re, gb, 63 - 2*log - 8);
yading@10 234 CLOSE_READER(re, gb);
yading@10 235
yading@10 236 return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
yading@10 237 }
yading@10 238 }
yading@10 239
yading@10 240 static inline int dirac_get_se_golomb(GetBitContext *gb){
yading@10 241 uint32_t buf;
yading@10 242 uint32_t ret;
yading@10 243
yading@10 244 ret = svq3_get_ue_golomb(gb);
yading@10 245
yading@10 246 if (ret) {
yading@10 247 OPEN_READER(re, gb);
yading@10 248 UPDATE_CACHE(re, gb);
yading@10 249 buf = SHOW_SBITS(re, gb, 1);
yading@10 250 LAST_SKIP_BITS(re, gb, 1);
yading@10 251 ret = (ret ^ buf) - buf;
yading@10 252 CLOSE_READER(re, gb);
yading@10 253 }
yading@10 254
yading@10 255 return ret;
yading@10 256 }
yading@10 257
yading@10 258 /**
yading@10 259 * read unsigned golomb rice code (ffv1).
yading@10 260 */
yading@10 261 static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len){
yading@10 262 unsigned int buf;
yading@10 263 int log;
yading@10 264
yading@10 265 OPEN_READER(re, gb);
yading@10 266 UPDATE_CACHE(re, gb);
yading@10 267 buf=GET_CACHE(re, gb);
yading@10 268
yading@10 269 log= av_log2(buf);
yading@10 270
yading@10 271 if(log > 31-limit){
yading@10 272 buf >>= log - k;
yading@10 273 buf += (30-log)<<k;
yading@10 274 LAST_SKIP_BITS(re, gb, 32 + k - log);
yading@10 275 CLOSE_READER(re, gb);
yading@10 276
yading@10 277 return buf;
yading@10 278 }else{
yading@10 279 LAST_SKIP_BITS(re, gb, limit);
yading@10 280 UPDATE_CACHE(re, gb);
yading@10 281
yading@10 282 buf = SHOW_UBITS(re, gb, esc_len);
yading@10 283
yading@10 284 LAST_SKIP_BITS(re, gb, esc_len);
yading@10 285 CLOSE_READER(re, gb);
yading@10 286
yading@10 287 return buf + limit - 1;
yading@10 288 }
yading@10 289 }
yading@10 290
yading@10 291 /**
yading@10 292 * read unsigned golomb rice code (jpegls).
yading@10 293 */
yading@10 294 static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len){
yading@10 295 unsigned int buf;
yading@10 296 int log;
yading@10 297
yading@10 298 OPEN_READER(re, gb);
yading@10 299 UPDATE_CACHE(re, gb);
yading@10 300 buf=GET_CACHE(re, gb);
yading@10 301
yading@10 302 log= av_log2(buf);
yading@10 303
yading@10 304 if(log - k >= 32-MIN_CACHE_BITS+(MIN_CACHE_BITS==32) && 32-log < limit){
yading@10 305 buf >>= log - k;
yading@10 306 buf += (30-log)<<k;
yading@10 307 LAST_SKIP_BITS(re, gb, 32 + k - log);
yading@10 308 CLOSE_READER(re, gb);
yading@10 309
yading@10 310 return buf;
yading@10 311 }else{
yading@10 312 int i;
yading@10 313 for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
yading@10 314 if (gb->size_in_bits <= re_index)
yading@10 315 return -1;
yading@10 316 LAST_SKIP_BITS(re, gb, 1);
yading@10 317 UPDATE_CACHE(re, gb);
yading@10 318 }
yading@10 319 SKIP_BITS(re, gb, 1);
yading@10 320
yading@10 321 if(i < limit - 1){
yading@10 322 if(k){
yading@10 323 buf = SHOW_UBITS(re, gb, k);
yading@10 324 LAST_SKIP_BITS(re, gb, k);
yading@10 325 }else{
yading@10 326 buf=0;
yading@10 327 }
yading@10 328
yading@10 329 CLOSE_READER(re, gb);
yading@10 330 return buf + (i<<k);
yading@10 331 }else if(i == limit - 1){
yading@10 332 buf = SHOW_UBITS(re, gb, esc_len);
yading@10 333 LAST_SKIP_BITS(re, gb, esc_len);
yading@10 334 CLOSE_READER(re, gb);
yading@10 335
yading@10 336 return buf + 1;
yading@10 337 }else
yading@10 338 return -1;
yading@10 339 }
yading@10 340 }
yading@10 341
yading@10 342 /**
yading@10 343 * read signed golomb rice code (ffv1).
yading@10 344 */
yading@10 345 static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len){
yading@10 346 int v= get_ur_golomb(gb, k, limit, esc_len);
yading@10 347
yading@10 348 v++;
yading@10 349 if (v&1) return v>>1;
yading@10 350 else return -(v>>1);
yading@10 351
yading@10 352 // return (v>>1) ^ -(v&1);
yading@10 353 }
yading@10 354
yading@10 355 /**
yading@10 356 * read signed golomb rice code (flac).
yading@10 357 */
yading@10 358 static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len){
yading@10 359 int v= get_ur_golomb_jpegls(gb, k, limit, esc_len);
yading@10 360 return (v>>1) ^ -(v&1);
yading@10 361 }
yading@10 362
yading@10 363 /**
yading@10 364 * read unsigned golomb rice code (shorten).
yading@10 365 */
yading@10 366 static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){
yading@10 367 return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
yading@10 368 }
yading@10 369
yading@10 370 /**
yading@10 371 * read signed golomb rice code (shorten).
yading@10 372 */
yading@10 373 static inline int get_sr_golomb_shorten(GetBitContext* gb, int k)
yading@10 374 {
yading@10 375 int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
yading@10 376 if (uvar & 1)
yading@10 377 return ~(uvar >> 1);
yading@10 378 else
yading@10 379 return uvar >> 1;
yading@10 380 }
yading@10 381
yading@10 382
yading@10 383
yading@10 384 #ifdef TRACE
yading@10 385
yading@10 386 static inline int get_ue(GetBitContext *s, const char *file, const char *func,
yading@10 387 int line)
yading@10 388 {
yading@10 389 int show= show_bits(s, 24);
yading@10 390 int pos= get_bits_count(s);
yading@10 391 int i= get_ue_golomb(s);
yading@10 392 int len= get_bits_count(s) - pos;
yading@10 393 int bits= show>>(24-len);
yading@10 394
yading@10 395 print_bin(bits, len);
yading@10 396
yading@10 397 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
yading@10 398
yading@10 399 return i;
yading@10 400 }
yading@10 401
yading@10 402 static inline int get_se(GetBitContext *s, const char *file, const char *func,
yading@10 403 int line)
yading@10 404 {
yading@10 405 int show= show_bits(s, 24);
yading@10 406 int pos= get_bits_count(s);
yading@10 407 int i= get_se_golomb(s);
yading@10 408 int len= get_bits_count(s) - pos;
yading@10 409 int bits= show>>(24-len);
yading@10 410
yading@10 411 print_bin(bits, len);
yading@10 412
yading@10 413 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
yading@10 414
yading@10 415 return i;
yading@10 416 }
yading@10 417
yading@10 418 static inline int get_te(GetBitContext *s, int r, char *file, const char *func, int line){
yading@10 419 int show= show_bits(s, 24);
yading@10 420 int pos= get_bits_count(s);
yading@10 421 int i= get_te0_golomb(s, r);
yading@10 422 int len= get_bits_count(s) - pos;
yading@10 423 int bits= show>>(24-len);
yading@10 424
yading@10 425 print_bin(bits, len);
yading@10 426
yading@10 427 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
yading@10 428
yading@10 429 return i;
yading@10 430 }
yading@10 431
yading@10 432 #define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
yading@10 433 #define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
yading@10 434 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
yading@10 435 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
yading@10 436
yading@10 437 #endif
yading@10 438
yading@10 439 /**
yading@10 440 * write unsigned exp golomb code.
yading@10 441 */
yading@10 442 static inline void set_ue_golomb(PutBitContext *pb, int i){
yading@10 443 int e;
yading@10 444
yading@10 445 av_assert2(i>=0);
yading@10 446
yading@10 447 #if 0
yading@10 448 if(i=0){
yading@10 449 put_bits(pb, 1, 1);
yading@10 450 return;
yading@10 451 }
yading@10 452 #endif
yading@10 453 if(i<256)
yading@10 454 put_bits(pb, ff_ue_golomb_len[i], i+1);
yading@10 455 else{
yading@10 456 e= av_log2(i+1);
yading@10 457
yading@10 458 put_bits(pb, 2*e+1, i+1);
yading@10 459 }
yading@10 460 }
yading@10 461
yading@10 462 /**
yading@10 463 * write truncated unsigned exp golomb code.
yading@10 464 */
yading@10 465 static inline void set_te_golomb(PutBitContext *pb, int i, int range){
yading@10 466 av_assert2(range >= 1);
yading@10 467 av_assert2(i<=range);
yading@10 468
yading@10 469 if(range==2) put_bits(pb, 1, i^1);
yading@10 470 else set_ue_golomb(pb, i);
yading@10 471 }
yading@10 472
yading@10 473 /**
yading@10 474 * write signed exp golomb code. 16 bits at most.
yading@10 475 */
yading@10 476 static inline void set_se_golomb(PutBitContext *pb, int i){
yading@10 477 #if 0
yading@10 478 if(i<=0) i= -2*i;
yading@10 479 else i= 2*i-1;
yading@10 480 #elif 1
yading@10 481 i= 2*i-1;
yading@10 482 if(i<0) i^= -1; //FIXME check if gcc does the right thing
yading@10 483 #else
yading@10 484 i= 2*i-1;
yading@10 485 i^= (i>>31);
yading@10 486 #endif
yading@10 487 set_ue_golomb(pb, i);
yading@10 488 }
yading@10 489
yading@10 490 /**
yading@10 491 * write unsigned golomb rice code (ffv1).
yading@10 492 */
yading@10 493 static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
yading@10 494 int e;
yading@10 495
yading@10 496 av_assert2(i>=0);
yading@10 497
yading@10 498 e= i>>k;
yading@10 499 if(e<limit){
yading@10 500 put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1)));
yading@10 501 }else{
yading@10 502 put_bits(pb, limit + esc_len, i - limit + 1);
yading@10 503 }
yading@10 504 }
yading@10 505
yading@10 506 /**
yading@10 507 * write unsigned golomb rice code (jpegls).
yading@10 508 */
yading@10 509 static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len){
yading@10 510 int e;
yading@10 511
yading@10 512 av_assert2(i>=0);
yading@10 513
yading@10 514 e= (i>>k) + 1;
yading@10 515 if(e<limit){
yading@10 516 while(e > 31) {
yading@10 517 put_bits(pb, 31, 0);
yading@10 518 e -= 31;
yading@10 519 }
yading@10 520 put_bits(pb, e, 1);
yading@10 521 if(k)
yading@10 522 put_sbits(pb, k, i);
yading@10 523 }else{
yading@10 524 while(limit > 31) {
yading@10 525 put_bits(pb, 31, 0);
yading@10 526 limit -= 31;
yading@10 527 }
yading@10 528 put_bits(pb, limit , 1);
yading@10 529 put_bits(pb, esc_len, i - 1);
yading@10 530 }
yading@10 531 }
yading@10 532
yading@10 533 /**
yading@10 534 * write signed golomb rice code (ffv1).
yading@10 535 */
yading@10 536 static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
yading@10 537 int v;
yading@10 538
yading@10 539 v = -2*i-1;
yading@10 540 v ^= (v>>31);
yading@10 541
yading@10 542 set_ur_golomb(pb, v, k, limit, esc_len);
yading@10 543 }
yading@10 544
yading@10 545 /**
yading@10 546 * write signed golomb rice code (flac).
yading@10 547 */
yading@10 548 static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len){
yading@10 549 int v;
yading@10 550
yading@10 551 v = -2*i-1;
yading@10 552 v ^= (v>>31);
yading@10 553
yading@10 554 set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
yading@10 555 }
yading@10 556
yading@10 557 #endif /* AVCODEC_GOLOMB_H */