[FFmpeg-devel] [PATCH] get_bits_left()

Ronald S. Bultje rsbultje
Mon Nov 16 18:44:48 CET 2009


Hi,

On Mon, Nov 9, 2009 at 6:05 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Nov 09, 2009 at 05:14:02PM -0500, Ronald S. Bultje wrote:
>> On Mon, Nov 9, 2009 at 1:21 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> Now, as for:
[..]
>> > On Mon, Nov 09, 2009 at 10:29:07AM -0500, Ronald S. Bultje wrote:
>> >> alac.c: ? ?if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
>> >> alac.c: ? ? ? ?av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",
>> >> input_buffer_size * 8 - get_bits_count(&alac->gb));
>> >> h261dec.c: ? ? ? ?left= s->gb.size_in_bits - get_bits_count(&s->gb);
>> >> h261dec.c: ? ?for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=1){
>> >> h263.c: ? ?left= s->gb.size_in_bits - get_bits_count(&s->gb);
>> >> h263.c: ? ?left= s->gb.size_in_bits - get_bits_count(&s->gb);
>> >> h263.c://printf("%06X %d\n", show_bits(&s->gb, 24), s->gb.size_in_bits
>> >> - get_bits_count(&s->gb));
>> >> h263.c: ? ?for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=8) {
>> >> h263dec.c://printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 -
>> >> get_bits_count(&s->gb), show_bits(&s->gb, 24));
>> >> h263dec.c: ? ? ? && ? ?s->gb.size_in_bits - get_bits_count(&s->gb) >=0
>> >> h263dec.c: ? ? ? && ? ?s->gb.size_in_bits - get_bits_count(&s->gb) < 48
>> >> h263dec.c: ? ? ? ?int left= s->gb.size_in_bits - get_bits_count(&s->gb);
>> >> h263dec.c: ? ? ? ? ? ?s->gb.size_in_bits - get_bits_count(&s->gb),
>> >> h264.c: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ( s->gb.size_in_bits -
>> >> get_bits_count(&s->gb) + 7)/8);
>> >> huffyuv.c: ? ?if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*4)){
>> >> huffyuv.c: ? ?if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*2)){
>> >> mpeg12.c: ? ? ? ? ? ? ? ?int left= s->gb.size_in_bits - get_bits_count(&s->gb);
>> >> mpegaudiodec.c: ? ? ? ? ? ?i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3;
>> >> mpegaudiodec.c: ? ? ? ?i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3;
>> >> msmpeg4.c: ? ? ? ? ? ? ? ?const int left= s->gb.size_in_bits -
>> >> get_bits_count(&s->gb);
>> >> wavpack.c: ? ? ? ?const int left_bits = s->gb_extra_bits.size_in_bits
>> >> - get_bits_count(&s->gb_extra_bits);
>> >> wavpack.c: ? ? ? ?const int size = s->gb_extra_bits.size_in_bits -
>> >> get_bits_count(&s->gb_extra_bits);
>>
>> Can I fix all of the above (I cut the non-obvious ones out) without
>> further patches?
>
> you can replace the "s->gb.size_in_bits - get_bits_count(&s->gb)" stuff

Done.

There is some low-hanging fruits that respective maintainers could do
to make other code smaller. E.g. in qdm2.c, there is a BITS_LEFT()
macro, and there may be others as well. I think these can be removed /
replaced now.

Ronald



More information about the ffmpeg-devel mailing list