[FFmpeg-devel] [PATCH 3/4] avcodec/dca: simplify condition

Michael Niedermayer michael at niedermayer.cc
Thu Mar 3 12:34:07 CET 2016


On Thu, Mar 03, 2016 at 12:59:19AM +0100, Hendrik Leppkes wrote:
> On Wed, Mar 2, 2016 at 8:32 PM, foo86 <foobaz86 at gmail.com> wrote:
> > ---
> >  libavcodec/dca_xll.c | 17 ++++++-----------
> >  1 file changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
> > index ffe8ef3..5e6cf35 100644
> > --- a/libavcodec/dca_xll.c
> > +++ b/libavcodec/dca_xll.c
> > @@ -460,19 +460,14 @@ static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int s
> >              // Unpack Rice coding flag
> >              // 0 - linear code, 1 - Rice code
> >              c->rice_code_flag[i] = get_bits1(&s->gb);
> > -            if (!c->seg_common && c->rice_code_flag[i]) {
> > -                // Unpack Hybrid Rice coding flag
> > -                // 0 - Rice code, 1 - Hybrid Rice code
> > -                if (get_bits1(&s->gb))
> > -                    // Unpack binary code length for isolated samples
> > -                    c->bitalloc_hybrid_linear[i] = get_bits(&s->gb, c->nabits) + 1;
> > -                else
> > -                    // 0 indicates no Hybrid Rice coding
> > -                    c->bitalloc_hybrid_linear[i] = 0;
> > -            } else {
> > +            // Unpack Hybrid Rice coding flag
> > +            // 0 - Rice code, 1 - Hybrid Rice code
> > +            if (!c->seg_common && c->rice_code_flag[i] && get_bits1(&s->gb))
> > +                // Unpack binary code length for isolated samples
> > +                c->bitalloc_hybrid_linear[i] = get_bits(&s->gb, c->nabits) + 1;
> > +            else
> >                  // 0 indicates no Hybrid Rice coding
> >                  c->bitalloc_hybrid_linear[i] = 0;
> > -            }
> >          }
> >
> >          // Unpack coding parameters
> > --
> > 2.1.4
> 
> LGTM, logic appears unchanged afterall.

applied

thanks

[...]
--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160303/d311d76b/attachment.sig>


More information about the ffmpeg-devel mailing list