[FFmpeg-devel] lavf/matroska*: add support for signed integers
Michael Niedermayer
michaelni at gmx.at
Fri Nov 15 21:37:40 CET 2013
On Fri, Nov 15, 2013 at 07:00:37PM +0100, Jan Gerber wrote:
> On 11/15/2013 05:42 PM, Michael Niedermayer wrote:
> >> EBML_STOP,
> >> - EBML_TYPE_COUNT
> >> + EBML_TYPE_COUNT,
> >> + EBML_SINT,
> >> } EbmlType;
> >>
> >> typedef const struct EbmlSyntax {
> >
> > EBML_TYPE_COUNT is the number of enum types its used as size for
> > some array
> >
> ok
>
> >> + if (size == 0) {
> >> + *num = 0;
> >> + } else {
> >> + *num = avio_r8(pb);
> >> + /* negative value */
> >> + if (*num & 0x80) {
> >> + *num = (-1 << 8) | *num;
> >> + }
> >
> > can be simplified with sign_extend()
>
> not sure how that would work, sign_extend looks more complicated to me.
> feel free to improve before committing though.
>
> >> + /* make unsigned */
> >> + if (val >= 0) {
> >> + uval = val;
> >> + } else {
> >> + uval = 0x80 << (bytes - 1);
> >> + uval += val;
> >> + uval |= 0x80 << (bytes - 1);
> >> + }
> >
> > this should not be needed
> > signed integers are already in twos complement, simply storing them
> > bytewise should work
>
> not sure how that would look,
> but please improve.
ok, applied and improved
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131115/cbb0be64/attachment.asc>
More information about the ffmpeg-devel
mailing list