]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/golomb.h
Fix compilation when MMX is disabled.
[ffmpeg] / libavcodec / golomb.h
index a38bb669f0afdbd87f613e0ce1bc89cbb006c8e3..9bf7aec466bab312330916e20496324e96b07bc9 100644 (file)
@@ -3,19 +3,21 @@
  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  * Copyright (c) 2004 Alex Beregszaszi
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
 
@@ -288,7 +290,7 @@ static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int es
  * read unsigned golomb rice code (shorten).
  */
 static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){
-       return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
+        return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
 }
 
 /**
@@ -395,7 +397,7 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range){
  */
 static inline void set_se_golomb(PutBitContext *pb, int i){
 //    if (i>32767 || i<-32767)
-//     av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i);
+//        av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i);
 #if 0
     if(i<=0) i= -2*i;
     else     i=  2*i-1;
@@ -435,10 +437,18 @@ static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int lim
 
     e= (i>>k) + 1;
     if(e<limit){
+        while(e > 31) {
+            put_bits(pb, 31, 0);
+            e -= 31;
+        }
         put_bits(pb, e, 1);
         if(k)
             put_bits(pb, k, i&((1<<k)-1));
     }else{
+        while(limit > 31) {
+            put_bits(pb, 31, 0);
+            limit -= 31;
+        }
         put_bits(pb, limit  , 1);
         put_bits(pb, esc_len, i - 1);
     }