Thread: Where can I find information about segmented downloading?

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    27

    Where can I find information about segmented downloading?

    I am wanting to do segmented video encoding and thought that this would be a good thing to look up. I mean if download managers can put the file together exactly as it is supposed to be shouldn't I be able to do the same with video or audio files? I mean have separate threads working on different parts of the video and piece them all together at the end. Thanks

  2. #2
    Registered User
    Join Date
    Apr 2013
    Posts
    1,658
    My understanding of video encoders or at least some of them is that they separate each video frame into segments (2 segments for 2 cores, 4 segments for 4 cores, ...), as opposed to working on different parts of the video stream. I'm not sure how they deal with the borders of each segment.

    For audio, the left and right channels could be worked on in parallel. If more channels are used in an audio stream, like surround sound, then more cores could be used.

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I mean if download managers can put the file together exactly as it is supposed to be shouldn't I be able to do the same with video or audio files?
    O_o

    Whether or not you can "segment" encoding/decoding of an image depends entirely on the algorithms and data on which the "codec" operations.

    For example, if you are doing encoding of macroblocks for intra-frame compression, you can easily give each thread a block of its own; as each block always requires and represents the same number of pixels, the logical is trivially split over multiple threads.

    However, if you are doing variable bit encoding for inter-frame compression using some form of motion prediction and encoding, you would probably be worse off for using threads because you need to consume and produce heavily varied amounts of data; a better approach might be splitting each step of the process into a thread from a pool and producing a queue of "work" to be used in each successive step.

    Of course, everything I could say would be a guess without knowing which "codec" you are using. The point is, generating a new video stream isn't the same as downloading an existing file.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    H264 codec uses NAL-Units to "segment" the video
    NAL-Unit could be as big as one frame...
    Or as small as one line of macro-blocks

    Intel IPP encoder when run in multi-threaded mode encodes each NAL-Unit separately as a Task. Each task is assigned to the free working thread.
    (720p frame has dimension of 80x45 macroblocks, so each frame could be split into 45 NAL-Units, so 45 working threads could work in parallel on one frame encoding...)

    Of course all NAL-Units should be concatenated in write order into frame before next frame encoding could start.

    Intel IPP library is free for personal use on linux - so you can downloaded it as well as sample H264 encoder/decoder application and see the code by yourself.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    27
    Where can I find some C source for segmented downloading? I am really interested to see how this actually works. Surely there must be some source out there, so far google has turned up a bunch of nothing. Thanks

  6. #6
    young grasshopper jwroblewski44's Avatar
    Join Date
    May 2012
    Location
    Where the sidewalk ends
    Posts
    294
    Do some research on Linux ultra fast command line download accelerator. It's not actual C source, but it will give you an idea of where to start.
    "Simplicity is the ultimate sophistication." - Leonardo da Vinci

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-08-2011, 06:26 AM
  2. Replies: 5
    Last Post: 01-18-2010, 07:25 AM
  3. Downloading OpenGL - cannot find anywhere?
    By Jake.c in forum Game Programming
    Replies: 10
    Last Post: 03-01-2009, 10:48 AM
  4. Where to find information about C/C++ history
    By JOCAAN in forum Tech Board
    Replies: 1
    Last Post: 12-29-2007, 10:34 AM
  5. Segmented downloads.
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 10-09-2002, 01:11 PM