Change the CameraPreview width -- for iMX51

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change the CameraPreview width -- for iMX51

1,509 Views
charleschang
Contributor III

Hello

Our product uses adv7180 to display the DVD cvbs content.

after applying the imx53 10.4 adv7180 de-interlace patch, the camera preview funciton works fine.

But our LCD resolution is 800x480, so there will be 2 black regions when displaying the 640x480 DVD content.

How can I change the camera preview display to 800x480 ?

Thanks.

Charles.

0 Kudos
7 Replies

958 Views
charleschang
Contributor III

I run mxc_v4l2_tvin -ow 800 -oh 480 , it display a full 800x480 OK. just quality is poor, seem no de-interlace .

then I add -m 0 to enable de-interlace, it fail, just show the black screen,

so I comment out some codes in kernel driver:

diff --git a/drivers/media/video/mxc/output/mxc_v4l2_output.c b/drivers/media/video/mxc/output/mxc_v4l2_output.c

index 39c362f..82738cc6 100755

--- a/drivers/media/video/mxc/output/mxc_v4l2_output.c

+++ b/drivers/media/video/mxc/output/mxc_v4l2_output.c

@@ -1686,10 +1686,10 @@ static int mxc_v4l2out_streamon(vout_data *vout)

                vout->display_input_ch = vout->post_proc_ch;

                memset(&params, 0, sizeof(params));

                if (INTERLACED_CONTENT(vout)) {

-                       if (vdi_split && LOAD_3FIELDS(vout)) {

+/*                     if (vdi_split && LOAD_3FIELDS(vout)) {

                                dev_err(&vout->video_dev->dev, "VDI split does not support 3 fields mode yet.\n");

                                return -1;

-                       } else

+                       } else*/

                                rc = init_VDI(params, vout, dev, fbi, out_width, out_height);

                } else {

                        rc = init_PP(&params, vout, dev, fbi, out_width, out_height);

It can show a full screen with -m 0 option (de-interlace enabled).

but the android ap , throught the camera framework , still show just half screen.

0 Kudos

958 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

You can reference to the followed patch: https://community.freescale.com/message/295321

And if you are using mxc_v4l2_tvin.out application, you can use the followed command to show preview as 800x480:

./mxc_v4l2_tvin.out -ow 800 -oh 480 -m 2

958 Views
charleschang
Contributor III

Hi Qiang Li.

I already use that patch. that patch make ADV6180 deinterlace workable.

I've tried the mxc_v4l2_tvin,out, and specify -ow 800.

This can put the adv7180 content to full screen.

But how can I put this option  to Android Camera Module ?

I've modify the S_CROP parameter in hardware/imx5x/liboverlay,

It doesn't work..

Charles.

0 Kudos

958 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

    Since you had applied that patch, the liboverlay is OK to support any resolution, but for the preview window size, it is created by the camera app. I think you need survey this application, no code modification was needed for camera HAL and lib overlay. The camera app created the overlay surface with preview window size, the liboverlay just resize the 720*480 camera input to overlay surface size for preview.


0 Kudos

958 Views
charleschang
Contributor III

I've tried.

but it only works when I set the size  smaller than 720x480.

when I set a value larger than 720 (for example: 800), it only show half of the preview image.

and I found an error in logcat:

I/ipulib (2933): external/linux-lib/ipu/mxc_ipu_h1_lib.c: 3254 wait for irq21 time out!

Seems that it only support shrinking, not expanding..

By the way, the mxc_v4l2_tvin -ow 800 shows correctly in my machine,

but this method is not included in android framework/driver.

0 Kudos

958 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

Can you show how you modify the code?

0 Kudos

958 Views
charleschang
Contributor III

in kernel, android framework, I apply that adv7180 patch.

and the test program is simple:

=================================================

package test.camerapreview;

import java.io.IOException;

import android.util.Log;

import android.app.Activity;

import android.os.Bundle;

import android.hardware.Camera;

import android.view.SurfaceView;

import android.view.SurfaceHolder;

import android.content.Context;

class Preview extends SurfaceView implements SurfaceHolder.Callback {

  SurfaceHolder mHolder;

  Camera mCamera;

  Preview(Context context) {

  super(context);

  mHolder = getHolder();

  mHolder.addCallback(this);

  mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

  }

  public void surfaceCreated(SurfaceHolder holder) {

  mCamera = Camera.open();

  try {

  mCamera.setPreviewDisplay(holder);

  } catch (IOException e) {

  e.printStackTrace();

  }

  }

  public void surfaceDestroyed(SurfaceHolder holder) {

  mCamera.stopPreview();

  mCamera.release();

  mCamera = null;

  mHolder = null;

  }

  public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){

  Camera.Parameters parameters = mCamera.getParameters();

  parameters.setPreviewSize(720,480);

  mCamera.setParameters(parameters);

  mCamera.startPreview();

  }

}

and layout:

============================================

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="vertical"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    >

<TextView

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:text="@string/hello"

    />

</LinearLayout>

0 Kudos