[FFmpeg-devel] [PATCH] support for hardcoded mpegaudiodec tables

Michael Niedermayer michaelni
Tue Oct 27 17:05:51 CET 2009


On Thu, Oct 22, 2009 at 11:13:10PM +0200, Reimar D?ffinger wrote:
> On Thu, Oct 22, 2009 at 10:23:59PM +0200, Michael Niedermayer wrote:
> > On Thu, Oct 22, 2009 at 09:40:27PM +0200, Reimar D?ffinger wrote:
> > > On Thu, Oct 22, 2009 at 08:58:32PM +0200, Michael Niedermayer wrote:
> > > > On Thu, Oct 22, 2009 at 09:04:08AM +0200, Reimar D?ffinger wrote:
> > [...]
> > > > > Also just using printf does not work if you want the generated file not to
> > > > > look like a complete mess.
> > > > 
> > > > IMHO the generated file is not for human consumtion, its just an
> > > > intermediate to get the table into the object file
> > > > but nothing stops one to do a
> > > > if(++x % 8 ==0) printf("\n");
> > > > as well
> > > 
> > > Well, I admit I've never tested it since years, I just remember that
> > > in the past some compilers did not accept arbitrary-size lines (at least
> > > not in the area of MBs).
> > 
> > printf("%d\n", value);
> > does not generate such line
> 
> Ok.
> Still, I have to admit that I'd like to be able to misuse those table prints
> to check for optimization possibilities or some such, so having them
> somewhat human-readable is a plus.
> Also my proposal it hopefully is a one-time effort to implement.
> Have a look at the attached patch and say if you think if this looks
> like a sensible approach to you (obviously it lacks docs etc.).
> I think though that the Makefile should be changed to at least pass
> on CONFIG_SMALL to those host programs, too.

[...]

> +void write_int8_array(const void *arg, int len, int dummy)
> +{
> +    const int8_t *data = arg;
> +    int i;
> +    printf("   ");
> +    for (i = 0; i < len - 1; i++) {
> +       printf(" %3"PRIi8",", data[i]);
> +       if ((i & 15) == 15) printf("\n   ");
> +    }
> +    printf(" %3"PRIi8"\n", data[i]);
> +}
> +
> +void write_uint32_array(const void *arg, int len, int dummy)
> +{
> +    const uint32_t *data = arg;
> +    int i;
> +    printf("   ");
> +    for (i = 0; i < len - 1; i++) {
> +       printf(" 0x%08x,", data[i]);
> +       if ((i & 7) == 7) printf("\n   ");
> +    }
> +    printf(" 0x%08x\n", data[i]);
> +}
> +
> +void write_uint32_2d_array(const void *arg, int len, int len2)
> +{
> +    const uint32_t *data = arg;
> +    int i, j;
> +    printf("    {");
> +    for (i = 0; i < len; i++) {
> +        for (j = 0; j < len2 - 1; j++)
> +            printf("0x%08x, ", data[i * len2 + j]);
> +        printf("0x%08x}", data[i * len2 + j]);
> +        printf(i == len - 1 ? "\n" : ",\n    {");
> +    }
> +}

up to these your implementation did not look that bad but this here
would need 2(signedness)(8/16/32/64/float/double)(1d/2d) ->
24 functions

Maybe a single 1d uint8 read and print function with a union could be
used. It would not lead to tables that could be read by a human though

alternatively a GET_DATA() like reader with double float writer could
be used.


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091027/b3664d73/attachment.pgp>



More information about the ffmpeg-devel mailing list