[FFmpeg-devel] [PATCH 3/3] libavcodec/ccaption_dec: rewrite packet handler as case statement; remove COR3 macro

Clément Bœsch u at pkh.me
Tue Jan 5 22:17:59 CET 2016


On Tue, Jan 05, 2016 at 09:35:41PM +0100, Clément Bœsch wrote:
> On Mon, Jan 04, 2016 at 07:28:03PM -0800, Aman Gupta wrote:
> > From: Aman Gupta <aman at tmm1.net>
[...]
> >      } else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) ||
> >                ( (hi >= 0x11 && hi <= 0x17) && (lo >= 0x40 && lo <= 0x7f) ) ) {
> >          handle_pac(ctx, hi, lo);
> >      } else if ( ( hi == 0x11 && lo >= 0x20 && lo <= 0x2f ) ||
> >                  ( hi == 0x17 && lo >= 0x2e && lo <= 0x2f) ) {
> >          handle_textattr(ctx, hi, lo);
[...]
> Looks OK, but the command handling really is clumsy in that decoder. I'm
> pretty sure we can do something better by handling the command as a
> uint16.
> 

To expand on this, the first condition would look something like this:

    if ((cmd & 0x7f60) == 0x1040 || (cmd & 0x7940) == 0x1140)

with cmd = bptr[i+1]<<8 | bptr[i+2]

(Note: cmd is assumed to be already masked with a 0x7f7f)

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160105/a4faf903/attachment.sig>


More information about the ffmpeg-devel mailing list