Find the answer to your Linux question:
Results 1 to 4 of 4
After 4 days struggling with C code written by people who have no sense of codestyle *pheh*, I've finally managed to create a real-time MP3 encoder, ("PCM sample in, MP3 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Location
    Delft, Holland
    Posts
    95

    The alignment of my code? I don't know, Chaotic Evil?


    After 4 days struggling with C code written by people who have no sense of codestyle *pheh*, I've finally managed to create a real-time MP3 encoder, ("PCM sample in, MP3 byte out" instead of "PCM file in, MP3 file out") based on the 8hz engine.

    It runs fine on my x86 machine, but when I compile it for my ARM processor and run it there I get the error "Please check 'psy_data'", this "psy_data" is an array holding lot's of strings used for the psychoacoustic analysis.

    So I add some printf statements to the code to try to find the problem, after I've located the problem I add some more printf statements to get the variables it seems to hate.
    I compile it, run it, and then the code runs astray somewhere else, huh?
    I again add some printf statement, and in the next run it crashes at the original spot.

    So I run to my mentor, crying bug and he mumbles something about the alignment of my code, "ah you're a D&D fan too?". "No" he says, and he recalls something very vague about WORD-alignments, but he can't figure what it was exactly.


    So here's my question: is it something with word-alignment and how do I fix it?

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    To improve the appearance of the code you can use indent

    The compiler should take care everything having to do with alignments
    as long as you use the correct kind of pointers.Do you use any unusual options
    to compile ?

  3. #3
    Just Joined!
    Join Date
    Feb 2005
    Location
    Delft, Holland
    Posts
    95
    Well I finally got it to work, it seems I did not use the proper arguments to use the floating point coprocessor (fabs returned incorrect results), but I still can't explain why it crashed at two whole different locations.

    But it encodes now, at a supersonic speed of 30 minutes for every minute of MP3 produced Which means 8hz is out.

  4. $spacer_open
    $spacer_close
  5. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Generally, if adding printf()s changes the behaviour of your code, you're doing something nasty with your memory usage. Adding the extra printf() data often moves things around enough to change the perceived side-effects of trampling on data areas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •