×

Discussion Board

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 34
  1. #16
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    i'll check my code when i have time.


    yep. A little slower if you high res preview (maybe because i recreate), but you can change this resolution. I keep default preview resolution because change preview resolution take few seconds.
    well, the preview resolution was default (which was 1024*768 with lumia 920), in my app, when I moved the camera, the screen refresh very very slowly, and not smootly at all. Hope that you could get my mind due to my pool english

  2. #17
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    On 920, i have aproximatly a framerate of 20 with highres preview. On 820, same as camera preview.

    [edit]
    you can test this method to improve transfert between camera and texture : http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx
    Last edited by yan_; 2013-06-24 at 13:01.

  3. #18
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    On 920, i have aproximatly a framerate of 20 with highres preview. On 820, same as camera preview.

    [edit]
    you can test this method to improve transfert between camera and texture : http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx
    After I changed the way passing data to the d3d compotent from thread to PreviewFrameAviale event, I can get a framerate of 25 on my 920.

  4. #19
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    On 920, you don't see a small slow-down of framerate?

  5. #20
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    Hi
    You can download Dx part of my project here :
    https://skydrive.live.com/redir?resi...6D45C8F7A!4226

    You'll find :
    - update texture with map/unmap
    - offscreen rendering
    - mutex lock
    - two event connected/disconnected. Before sent something to DX, you must be connected.


    [edit]
    others informations :

    -To render off-screen, you must recreate a target texture with MiscFlags = 0. Texture use to display on screen have specific MiscFlags and you retrieves only black pixel.
    - You must use a depthStencil with same dimension
    - to access pixel, you must transfert pixel data to a STAGING texture.
    - you use Map/unmap to acces pixel.

    yan
    Last edited by yan_; 2013-06-25 at 08:34.

  6. #21
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    Hi
    You can download Dx part of my project here :
    https://skydrive.live.com/redir?resi...6D45C8F7A!4226

    You'll find :
    - update texture with map/unmap
    - offscreen rendering
    - mutex lock
    - two event connected/disconnected. Before sent something to DX, you must be connected.


    [edit]
    others informations :

    -To render off-screen, you must recreate a target texture with MiscFlags = 0. Texture use to display on screen have specific MiscFlags and you retrieves only black pixel.
    - You must use a depthStencil with same dimension
    - to access pixel, you must transfert pixel data to a STAGING texture.
    - you use Map/unmap to acces pixel.

    yan
    Thanks for the wonderful tips. But I found that it was not necessary to create the texture every time when passing the argb data, just update the texture data the next time(use map/unmap ?).

  7. #22
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by small2 View Post
    But I found that it was not necessary to create the texture every time when passing the argb data, just update the texture data the next time(use map/unmap ?).
    ??
    it's what i do now with this code. I use a dynamic tetxure and update it with map/unmap.

  8. #23
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    ??
    it's what i do now with this code. I use a dynamic texture and update it with map/unmap.
    Well, I got it!

  9. #24
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by small2 View Post
    Well, I got it!

    if you find oher improvement, i'm interested ^^

  10. #25
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post

    if you find oher improvement, i'm interested ^^
    if that I'll show you as soon as possible.

  11. #26
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    Last improvement possible, is using directly Yuv data.
    But i'm not sure if Yuv texture is supported on WP.

  12. #27
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    Hi
    You can download Dx part of my project here :
    https://skydrive.live.com/redir?resi...6D45C8F7A!4226

    You'll find :
    - update texture with map/unmap
    - offscreen rendering
    - mutex lock
    - two event connected/disconnected. Before sent something to DX, you must be connected.


    [edit]
    others informations :

    -To render off-screen, you must recreate a target texture with MiscFlags = 0. Texture use to display on screen have specific MiscFlags and you retrieves only black pixel.
    - You must use a depthStencil with same dimension
    - to access pixel, you must transfert pixel data to a STAGING texture.
    - you use Map/unmap to acces pixel.

    yan
    HI, yan, I modified your project and created a simple demo, so far I was stucking in the several problems.
    1. the texture could not fill the full-screen(not offf-screen ,as your original project showed) , and when the orientation turned from portrait to horizontal, the texture's data(the frame data comes from the camera) din't show as the original rate, instead showed as a square.
    2. In the Perspective matrix mode, after I set the aspectratio to 1.0, the texture showed as the original rate, but in the Orthographic matrix mode, the texture show as a square.
    3. I didn't know why the screen shake so heavily when I moved the camera.

    And here was my project: http://sdrv.ms/16z5XG9

    [edit]
    When I changed the matrix back to Perspective and modify the vertex to the following, the object in the camera didn't show as the normal rate.
    aspectRatio=1.0f; //otherwise, it show as a square

    XMStoreFloat4x4(
    &m_constantBufferData.projection,
    XMMatrixTranspose(
    XMMatrixPerspectiveFovRH(
    fovAngleY,
    aspectRatio,
    0.01f,
    100.0f
    )
    )
    );

    double v[] ={
    -3.73, -3.73, 0.0f, 1.0f, 0.0f,
    -3.73, 3.73, 0.0f, 0.0f, 0.0f,
    3.73, 3.73, 0.0f, 0.0f, 1.0f,
    3.73, -3.73, 0.0f, 1.0f, 1.0f,


    };
    Last edited by small2; 2013-06-26 at 13:25.

  13. #28
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    Hi.
    In my application, i use square image

    3. I didn't know why the screen shake so heavily when I moved the camera.
    If i understand correctly, PreviewFrameAvailable can be called by different thread. So you can update image data and copy it to the texture in same time.

    In my project, to remove shake, i've add a Boolean to not update data if copy to texture is not finished.
    Something like that

    Code:
    bool previewUpdateRunning = false
    void PreviewFrameAvailable ()
    {
    if (previewUpdateRunning ) return;
    previewUpdateRunning  = true
    
    ...
    previewUpdateRunning =false;
    }

  14. #29
    Registered User
    Join Date
    Oct 2011
    Posts
    30

    Re: troubles on showing argb data in a surface control

    Quote Originally Posted by yan_ View Post
    Hi.
    In my application, i use square image


    If i understand correctly, PreviewFrameAvailable can be called by different thread. So you can update image data and copy it to the texture in same time.

    In my project, to remove shake, i've add a Boolean to not update data if copy to texture is not finished.
    Something like that

    Code:
    bool previewUpdateRunning = false
    void PreviewFrameAvailable ()
    {
    if (previewUpdateRunning ) return;
    previewUpdateRunning  = true
    
    ...
    previewUpdateRunning =false;
    }
    I think I had found the reason why the screen shake. When I put my finger in the front of the camera, and move the finger up and down, the screen's refresh rate could not catch up on with the finger's movement.

    [edit]
    after I put the process code(pass the data to the d3dintrop) to the UI Thread, it works more fluent the before with a framerate of 23.
    Code:
    object obj = new object();
            void _device_PreviewFrameAvailable(ICameraCaptureDevice sender, object args)
            {
                Dispatcher.BeginInvoke(delegate { 
                if (_device==null)
                    return;
    
                    lock(obj)
                    {
                    int[] buffer = new int[(int)_device.PreviewResolution.Width * (int)_device.PreviewResolution.Height];
                    _device.GetPreviewBufferArgb(buffer);
                    m_d3dInterop.CreateTexture(out buffer[0], (int)_device.PreviewResolution.Width, (int)_device.PreviewResolution.Height);
                    }
                });
                
            }
    Last edited by small2; 2013-06-27 at 02:44.

  15. #30
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: troubles on showing argb data in a surface control

    yes it's because you remove concurrent access (i'm pretty sure shake come from concurrent access. I've ever had same problem with industrial camera) like only ui thread acces GetPreviewBufferArgb and call CreateTexture.

    I don't know what is better. Maybe something between your solution and mine. With your solution if something lock the ui thread for 1 second you will stack 25 call in its eventloop. But you need only one when ui will be unlocked.

Similar Threads

  1. VKB is not showing up for CEikEdwin control - 5th Edition
    By ruchirvasavada in forum Symbian User Interface
    Replies: 1
    Last Post: 2011-01-06, 03:31
  2. problem:Browser control is not showing on N73 device
    By rahul.shalik.makode in forum Symbian
    Replies: 0
    Last Post: 2010-05-28, 07:24
  3. Volume control while showing a dialog
    By enigma_007 in forum Symbian
    Replies: 1
    Last Post: 2009-10-31, 08:20
  4. Copying content from Pixmap surface to window surface
    By mustaf in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2009-01-15, 06:58
  5. Control faded on showing menu pane
    By strike_noir in forum Symbian User Interface
    Replies: 5
    Last Post: 2008-10-16, 07:58

Posting Permissions

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