×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    CImageEncoder - encodes in hardware or software

    Does anyone know weather CImageEncoder actually performs the encoding (in my case to jpeg) in hardware or software? I have discovered that using an external lib, such as libjpeg, performs the encoding faster.
    I am wondering if there would be any use using both at the same time.

  2. #2
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    192

    Re: CImageEncoder - encodes in hardware or software

    Quote Originally Posted by erst View Post
    Does anyone know weather CImageEncoder actually performs the encoding (in my case to jpeg) in hardware or software? I have discovered that using an external lib, such as libjpeg, performs the encoding faster.
    I am wondering if there would be any use using both at the same time.
    Is libjpeg built into symbian, or did you have to port it?

  3. #3
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    I've downloaded an already ported and compiled version of it

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: CImageEncoder - encodes in hardware or software

    What phone are you using? Phones with appropriate hardware built in to the main processor (rather than on a separate camera accelerator) should use the hardware acceleration (I say should because I can't remember for sure whether this is the case but it was certainly the plan at one point). For current devices I think this is only those with an OMAP 2420 e.g. N95.

    What do you mean by "using both at the same time"? If libjpeg is better for your use case then why not use it?

    Sorcery

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: CImageEncoder - encodes in hardware or software

    Quote Originally Posted by Sorcery-ltd View Post
    What do you mean by "using both at the same time"? If libjpeg is better for your use case then why not use it?
    I would guess the question is about if one could benefit from encoding images with the HW-accelerated encoder - perhaps using negligible CPU time - and a SW-based encoder (using the CPU obviously) at the same time.

  6. #6
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    The thing is that I want to encode jpeg frames from raw data frames as fast as possible (the plan is later to somehow use the built-in mp4 encoder).

    So if most work is done in a hardware circuit I should be able to encode one frame with the encoder in the api, and while it's working start to encode on the cpu (libjpeg) in another thread.

    I've tried to encode with libjpeg in two threads parallelly, this since I wanted to see if would use both cpu kernels. Unfortunately this was terribly slow.

    I'll try this second approach.

    Currently I use N95 8GB and N73

  7. #7
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    Exactly wizard_hu_, I need the performance

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: CImageEncoder - encodes in hardware or software

    Well, the N95 8GB has a hardware imaging and video accelerator as part of the main SoC (OMAP 2420) and the N73 doesn't (OMAP 1710).

    So, you would hopefully find the N95 faster than the N73 for encoding - greater than the 50%(ish) CPU clock speed improvement. However, it may be that the accelerator is not used by the image conversion library or possibly only for decode.

    Using 2 threads in parallel is only likely to cause a lot of context switching. There are not 2 CPU cores, there are two separate chips, one of which is dedicated as a cellular modem.

    You won't be able to encode to MP4 with the built-in encoder (unless you are doing so direct from the camera) on some devices because they only do video encoding on a dedicated HW accelerator chip which sits in between the camera and the main SoC - I don't know if any devices have an interface to access the encoder functionality on such a chip yet but the N73 generation (3rd Edition) didn't.

    You should get some technical support from Nokia. The necessary APIs for interacting with the video codecs are not public.

    Sorcery

  9. #9
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    Thanks for the info!

    Encode directly from the camera is what I want.
    I was thinking about doing a regular video recording using CVideoRecorderUtility. I've only managed recording to a file (guess this is the only thing supported), so I'll have to "fake" a file or file handle somehow with a circular buffer.

    Or may I get the encoded video data directly to a stream somehow?
    Anyway, this is more complex, I need some way to differentiate between frames.

    How do I get the non-public APIs from Nokia? Thought that was "secret" stuff for Forum Nokia Pros and/or Champions, or for people that pays.

  10. #10
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: CImageEncoder - encodes in hardware or software

    Yep, you have to pay. :-(

    It's not exactly top secret but you'd be certain to need some help with it and I don't think there are binary compatibility guarantees across devices etc. If I actually had it myself I'd have had to sign an NDA and wouldn't be able to tell you anything though, so you're not likely to get any support with it on this board. Champions don't get special access to code without paying for it - sometimes early access to documentation/examples (so we can provide feedback usually) and I think a free technical support case. You'd need to join Pro or Launchpad and/or make an API partnering request.

    However, as I said, there are at least some devices where I don't think you can get low-level access to the encoder at all. The hardware accelerator just encodes to the appropriate format for you the API saves it to your specified file.

    There's a media recorder API you could look at. There are other posts about it on this board. You might need to do some of the video parsing yourself to separate out frames, I'm not sure what's available there. If you're just streaming straight from the camera you should have a good look at the public APIs before considering anything lower level that you might have to partner.

    Sorcery

  11. #11
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    I been trying the approach of using both libjpeg and the built-in jpeg encoder (CImageEncoder). I get pretty much the same performance as if I only use one so I guess all encoding is done in software after all.

    I been experimenting a bit and by some reason I get best performance by first preparing for video capturing by calling CCamera::PrepareVideoCaptureL() and then encoding with CImageEncoder in the MCameraObserver::ViewFinderFrameReady() function.

    The strange thing is that if I don't call PrepareVideoCaptureL() the framerate decreases. Also if I call CCamera::StartVideoCapture() the framerate goes down to around 8-10 fps.

    By calling CCamera::PrepareVideoCaptureL() and then get the frames from MCameraObserver::ViewFinderFrameReady() (which doesn't make a lot of sense) I get a framerate around 14-15 fps for 320x240 which is quite ok. This is on N95 however.

  12. #12
    Nokia Developer Expert
    Join Date
    Dec 2003
    Posts
    148

    Re: CImageEncoder - encodes in hardware or software

    erst,

    Preparing video capture affects the view finder frame rate. I think in this case it is lowered to 15 fps. You are encoding JPEG using CPU so the lowered frame rate is better because it loads CPU less than running view finder 30 fps. Also starting the video capture degrades your performance because it means more load for CPU to produce both view finder and video frames.

    All in all the best performance is achieved by minimizing all other CPU load than JPEG encoding. Or by using HW accelerated encoder in devices where that is available. You might also try encoding the YUV video frames and not running view finder at all. For JPEG encoding the frame must be converted to YUV anyway.

    Unfortunately I am not familiar with image encoding APIs so I can not help you there...
    janza

  13. #13
    Regular Contributor
    Join Date
    Oct 2006
    Posts
    157

    Re: CImageEncoder - encodes in hardware or software

    Thank you janza!

    Yes, the view finder frame rate is lowered to 15 fps. This is what makes the difference. I also figured I accidentally switched width and height of the view finder size, so it was only 240x180. When I changed to 320x240 I get around 10 fps for encoding. This is not in full screen mode so I don't know if it's accurate.

    I've also tried to not run the view finder and only the video capturing. Since the frame comes as a YUV I used libjpeg to encode it. Here I get worse frame rate, only around 7 fps.
    I've tried to put the libjpeg encoding in a separate thread, but it decreases the framerate even more.
    Here I set the frame rate for MCameraObserver::FrameBufferReady() to only 15 fps, but not much of a difference.

    I have to, since I want to display the camera view, convert the YUV frame to a bitmap anyway. This does not take much extra performance anyway, even though I wrote the YUV to bitmap function myself.

    In summery it seems to work best using the built-in image encoder and the view finder. Even though it implicitly converts back and forth between yuv and bitmap.

    I have discovered that using an external lib, such as libjpeg, performs the encoding faster.
    Yes, I was wrong before. Don't know why I got a different result before. Maybe it was because of lower resolution or something.

  14. #14
    Regular Contributor
    Join Date
    Aug 2006
    Location
    Cairo, Egypt
    Posts
    67

    Re: CImageEncoder - encodes in hardware or software

    I think using Media Recorder API in the SDK extension plugin API will be more helpful in your case just check the example project at this link http://wiki.forum.nokia.com/index.ph...a_Recorder_API

    Sameh

  15. #15
    Registered User
    Join Date
    Sep 2007
    Posts
    18

    Re: CImageEncoder - encodes in hardware or software

    Hi, I am also trying to encode YUV frames to JPEG, i don't really need over 10 fps. The thing is i can not convert from YUV to CFbsBitmap to use CImageEncoder (actually i can but with floating point operations resulting in awful performance). How can I improve that, or where can I find an integer based example or algorithm

    I also thought of using CVideoRecorderUtility and ran into the same problems, differentiating frames and using the same memory after I process it. I thought maby record in a descriptor, stop and record again. Maby if I use two descriptors and let it record in one while i process the other and maby ignore the frames. I have to test how much overhead this implies.

Similar Threads

  1. Replies: 0
    Last Post: 2006-08-25, 03:29
  2. CMMFCoded: hardware or software?
    By Rocco77 in forum Symbian Media (Closed)
    Replies: 8
    Last Post: 2005-12-07, 06:03
  3. Offline mode - Hardware or software?
    By teura666 in forum General Development Questions
    Replies: 1
    Last Post: 2005-10-05, 10:51
  4. Replies: 1
    Last Post: 2003-11-18, 07:10

Posting Permissions

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