summaryrefslogtreecommitdiff
authorbrian.zhu <brian.zhu@amlogic.com>2013-07-26 07:57:36 (GMT)
committer brian.zhu <brian.zhu@amlogic.com>2013-07-26 07:57:36 (GMT)
commit0fbd884d35494abcc2ca0fe0d37f527e4e084f41 (patch)
treef0819285c591ad9c6ae9bb0c626aa28e1a6b5805
parent6e7ce56872fc8c21578c422f1a51fecd8889ce14 (diff)
downloadcamera-0fbd884d35494abcc2ca0fe0d37f527e4e084f41.zip
camera-0fbd884d35494abcc2ca0fe0d37f527e4e084f41.tar.gz
camera-0fbd884d35494abcc2ca0fe0d37f527e4e084f41.tar.bz2
1. implement NV21 and YV 12 as jpeg decode output format.
2. Add supported video size parameter
Diffstat
-rwxr-xr-xCameraParameters.cpp1
-rwxr-xr-xV4LCameraAdapter/V4LCameraAdapter.cpp65
-rwxr-xr-xinc/CameraProperties.h1
-rwxr-xr-xinc/mjpeg/colorspaces.h6
-rwxr-xr-xinc/mjpeg/jutils.h7
-rwxr-xr-xmjpeg/colorspaces.c246
-rwxr-xr-xmjpeg/jpegdec.c32
7 files changed, 247 insertions, 111 deletions
diff --git a/CameraParameters.cpp b/CameraParameters.cpp
index 9391cc8..6fecf22 100755
--- a/CameraParameters.cpp
+++ b/CameraParameters.cpp
@@ -105,6 +105,7 @@ const char CameraProperties::MAX_NUM_METERING_AREAS[] = "prop-max-num-metering-a
const char CameraProperties::METERING_AREAS[] = "prop-metering-areas";
const char CameraProperties::VIDEO_SNAPSHOT_SUPPORTED[] = "prop-video-snapshot-supported";
const char CameraProperties::VIDEO_SIZE[] = "video-size";
+const char CameraProperties::SUPPORTED_VIDEO_SIZES[] = "prop-video-size-values";
const char CameraProperties::PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred-preview-size-for-video";
const char CameraProperties::PIXEL_FORMAT_RGB24[] = "rgb24";
diff --git a/V4LCameraAdapter/V4LCameraAdapter.cpp b/V4LCameraAdapter/V4LCameraAdapter.cpp
index 1a14070..a35f9ca 100755
--- a/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -188,7 +188,7 @@ status_t V4LCameraAdapter::initialize(CameraProperties::Properties* caps)
mSensorIndex++;
}
if(mSensorIndex >= (int)ARRAY_SIZE(SENSOR_PATH)){
- CAMHAL_LOGEB("Error while opening handle to V4L2 Camera: %s", strerror(errno));
+ CAMHAL_LOGEB("opening %dth Camera, error: %s", mSensorIndex, strerror(errno));
return -EINVAL;
}
#endif
@@ -1174,7 +1174,7 @@ char * V4LCameraAdapter::GetFrame(int &index)
ret = ioctl(mCameraHandle, VIDIOC_DQBUF, &mVideoInfo->buf);
if (ret < 0) {
#ifdef AMLOGIC_USB_CAMERA_SUPPORT
- if(EIO==errno){
+ if((EIO==errno) || (ENODEV==errno)){
mIsDequeuedEIOError = true;
CAMHAL_LOGEA("GetFrame: VIDIOC_DQBUF Failed--EIO\n");
mErrorNotifier->errorNotify(CAMERA_ERROR_SOFT);
@@ -1388,7 +1388,7 @@ int V4LCameraAdapter::previewThread()
memcpy( &previewTime1, &previewTime2, sizeof( struct timeval));
active_duration = mFrameInv - mFrameInvAdjust;
- if((mFrameInv >= 20000) //the interval between two frame more than 20 ms for cts
+ if((mFrameInv + 20000 > mParams.getPreviewFrameRate()) //kTestSlopMargin = 20ms from CameraGLTest
&&((active_duration>previewframeduration)||((active_duration + 5000)>previewframeduration))){ // more preview duration -5000 us
if(noFrame == false){ //current catch a picture,use it and release tmp buf;
if( mCache.index != -1){
@@ -2124,7 +2124,7 @@ extern "C" int getValidFrameSize(int camera_fd, int pixel_format, char *framesiz
frmsize.pixel_format = pixel_format;
if(ioctl(camera_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) == 0){
if(frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE){ //only support this type
- if((frmsize.discrete.width > support_w) && (frmsize.discrete.height >support_h)&&(preview == true))
+ if( preview && (frmsize.discrete.width > support_w) && (frmsize.discrete.height >support_h))
continue;
snprintf(tempsize, sizeof(tempsize), "%dx%d,", frmsize.discrete.width, frmsize.discrete.height);
strcat(framesize, tempsize);
@@ -2456,6 +2456,15 @@ static bool getCameraFocusArea(int camera_fd, char* max_num_focus_area, char*foc
return true;
}
+struct v4l2_frmsize_discrete VIDEO_PREFER_SIZES[]={
+ {176, 144},
+ {320, 240},
+ {352, 288},
+ {640, 480},
+ {1280,720},
+ {1920,1080},
+};
+
#ifdef AMLOGIC_VIRTUAL_CAMERA_SUPPORT
extern "C" void newloadCaps(int camera_id, CameraProperties::Properties* params);
#endif
@@ -2567,13 +2576,6 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
params->set(CameraProperties::PREVIEW_FORMAT,PREVIEW_FORMAT_420SP);
}
- //get preview size & set
- char *sizes = (char *) calloc (1, 1024);
- if(!sizes){
- CAMHAL_LOGDA("Alloc string buff error!");
- return;
- }
-
#ifdef AMLOGIC_USB_CAMERA_SUPPORT
#ifdef AMLOGIC_TWO_CH_UVC
int main_id = -1;
@@ -2661,6 +2663,22 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
params->set(CameraProperties::FRAMERATE_RANGE_IMAGE, "5000,15000");
params->set(CameraProperties::FRAMERATE_RANGE_VIDEO, "5000,15000");
#endif
+ //get preview size & set
+ char *sizes = (char *) calloc (1, 1024);
+ char *video_sizes = (char *) calloc (1, 1024);
+ char vsize_tmp[15];
+ if(!sizes || !video_sizes){
+ if(sizes){
+ free(sizes);
+ sizes = NULL;
+ }
+ if(video_sizes){
+ free(video_sizes);
+ video_sizes = NULL;
+ }
+ CAMHAL_LOGDA("Alloc string buff error!");
+ return;
+ }
memset(sizes,0,1024);
uint32_t preview_format = DEFAULT_PREVIEW_PIXEL_FORMAT;
@@ -2686,10 +2704,19 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
params->set(CameraProperties::SUPPORTED_PREVIEW_SIZES, sizes);
char * b = (char *)sizes;
+ int index = 0;
+
while(b != NULL){
if (sscanf(b, "%dx%d", &supported_w, &supported_h) != 2){
break;
}
+ for(index =0; index< (int)ARRAY_SIZE(VIDEO_PREFER_SIZES);index++){
+ if((VIDEO_PREFER_SIZES[index].width == supported_w) && (VIDEO_PREFER_SIZES[index].height == supported_h)){
+ sprintf(vsize_tmp,"%dx%d,", supported_w, supported_h);
+ strncat(video_sizes, vsize_tmp, sizeof(vsize_tmp));
+ break;
+ }
+ }
if((supported_w*supported_h)>(w*h)){
w = supported_w;
h = supported_h;
@@ -2698,17 +2725,24 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
if(b)
b++;
}
+ b = strrchr(video_sizes, ',');
+ if(NULL != b){
+ b[0] = '\0';
+ }
if((w>0)&&(h>0)){
memset(sizes, 0, 1024);
sprintf(sizes,"%dx%d",w,h);
}
params->set(CameraProperties::PREVIEW_SIZE, sizes);
+ params->set(CameraProperties::SUPPORTED_VIDEO_SIZES, video_sizes);
}else {
#ifdef AMLOGIC_USB_CAMERA_SUPPORT
params->set(CameraProperties::SUPPORTED_PREVIEW_SIZES, "320x240,176x144,160x120");
+ params->set(CameraProperties::SUPPORTED_VIDEO_SIZES, "320x240,176x144,160x120");
params->set(CameraProperties::PREVIEW_SIZE,"320x240");
#else
params->set(CameraProperties::SUPPORTED_PREVIEW_SIZES, "640x480,352x288,176x144");
+ params->set(CameraProperties::SUPPORTED_VIDEO_SIZES, "640x480,352x288,176x144");
params->set(CameraProperties::PREVIEW_SIZE,"640x480");
#endif
}
@@ -2765,7 +2799,14 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
params->set(CameraProperties::PICTURE_SIZE,"640x480");
#endif
}
- free(sizes);
+ if(sizes){
+ free(sizes);
+ sizes = NULL;
+ }
+ if(video_sizes){
+ free(video_sizes);
+ video_sizes = NULL;
+ }
char *focus_mode = (char *) calloc (1, 256);
char * def_focus_mode = (char *) calloc (1, 64);
diff --git a/inc/CameraProperties.h b/inc/CameraProperties.h
index 049d907..44ef803 100755
--- a/inc/CameraProperties.h
+++ b/inc/CameraProperties.h
@@ -152,6 +152,7 @@ public:
static const char VIDEO_SNAPSHOT_SUPPORTED[];
static const char VIDEO_SIZE[];
+ static const char SUPPORTED_VIDEO_SIZES[];
static const char PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
static const char PIXEL_FORMAT_RGB24[];
diff --git a/inc/mjpeg/colorspaces.h b/inc/mjpeg/colorspaces.h
index 8f0f325..8787c4f 100755
--- a/inc/mjpeg/colorspaces.h
+++ b/inc/mjpeg/colorspaces.h
@@ -23,6 +23,7 @@
#define COLORSPACES_H
#include "defs.h"
+#include "jutils.h"
/*convert yuv 420 planar (yu12) to yuv 422
* args:
@@ -254,7 +255,10 @@ void
yuv422pto422(int * out,unsigned char *pic,int width);
void
-yuv422pto420(int * out,unsigned char *pic,int width,unsigned char *uv);
+yuv422pto420sp(int * out, addr *pic,int width);
+
+void
+yuv422pto420p(int * out, addr *pic,int width);
/*use in utils.c for jpeg decoding 444 planar to 422
* args:
diff --git a/inc/mjpeg/jutils.h b/inc/mjpeg/jutils.h
index 2760426..f00bc10 100755
--- a/inc/mjpeg/jutils.h
+++ b/inc/mjpeg/jutils.h
@@ -134,7 +134,14 @@ struct scan
#define ERR_NO_EOI 13
#define ERR_BAD_TABLES 14
#define ERR_DEPTH_MISMATCH 15
+#define ERR_NOT_SUPPORTED 16
+typedef struct addr_s
+{
+ unsigned char *y;
+ unsigned char *v;
+ unsigned char *u;
+}addr;
int jpeg_decode(unsigned char **pic, unsigned char *buf, int width, int height,unsigned int outformat);
diff --git a/mjpeg/colorspaces.c b/mjpeg/colorspaces.c
index c11f287..9fdce8f 100755
--- a/mjpeg/colorspaces.c
+++ b/mjpeg/colorspaces.c
@@ -1397,40 +1397,35 @@ void yuv422pto422(int * out,unsigned char *pic,int width)
pic1 += 2 * (width -16);
}
}
-#if 1
-/*use in utils.c for jpeg decoding 422 planar to 420
-* args:
-* out: pointer to data output of idct (macroblocks yyyy u v)
-* pic: pointer to picture buffer (yuyv)
-* width: picture width
-*/
-void yuv422pto420(int * out,unsigned char *pic,int width, unsigned char *uv)
-{
- int j, k;
- unsigned char *pic0, *pic1;
- int *outy, *outu, *outv;
- int *outy1 ;
- int *outy2 ;
- int *outu1 ;
- int *outv1 ;
- //yyyyuv
- pic0 = pic;
- pic1 = pic + width;
- outy = out;
- outu = out + 64 * 4;
- outv = out + 64 * 5;
-
- for (j = 0; j < 4; j++)
- {
- outy1 = outy;
- outy2 = outy+8;
- outv1 = outv;
- outu1 = outu;
-
- for (k = 0; k < 2; k++)
- {
- asm volatile(
+void yuv422pto420sp(int * out, addr *pic, int width)
+{
+ int j, k;
+ unsigned char *pic0, *pic1,*uv;
+ int *outy, *outu, *outv;
+ int *outy1 ;
+ int *outy2 ;
+ int *outu1 ;
+ int *outv1 ;
+
+ //yyyyuv
+ pic0 = pic->y;
+ pic1 = pic->y + width;
+ uv = pic->v;
+ outy = out;
+ outu = out + 64 * 4;
+ outv = out + 64 * 5;
+
+ for (j = 0; j < 4; j++)
+ {
+ outy1 = outy;
+ outy2 = outy+8;
+ outv1 = outv;
+ outu1 = outu;
+
+ for (k = 0; k < 2; k++)
+ {
+ asm volatile(
"mov r0,#0 \n\t"
"vdup.u32 d30, r0 \n\t"
"mov r0,#255 \n\t"
@@ -1502,70 +1497,141 @@ void yuv422pto420(int * out,unsigned char *pic,int width, unsigned char *uv)
"vst4.8 {d22[0],d23[0],d24[0],d25[0]}, [%[uv]]! \n\t"
"vst4.8 {d26[0],d27[0],d28[0],d29[0]}, [%[uv]]! \n\t"
-//////////////////////////////
+ //////////////////////////////
"4:@end \n\t"
- : [outy1] "+r" (outy1), [outy2] "+r" (outy2),
- [pic0] "+r" (pic0), [pic1] "+r" (pic1),
- [outu1] "+r" (outu1), [outv1] "+r" (outv1),
- [uv] "+r" (uv)
- : [width] "r" (width)
- : "cc", "memory", "r0","r1", "r2", "r4", "q0", "q1"
- );
- }
- outy += 16;outu +=8; outv +=8;
- pic0 += 2 * (width - 8);
- pic1 += 2 * (width - 8);
- uv += width - 16;
- }
+ : [outy1] "+r" (outy1), [outy2] "+r" (outy2),
+ [pic0] "+r" (pic0), [pic1] "+r" (pic1),
+ [outu1] "+r" (outu1), [outv1] "+r" (outv1),
+ [uv] "+r" (uv)
+ : [width] "r" (width)
+ : "cc", "memory", "r0","r1", "r2", "r4", "q0", "q1"
+ );
+ }
+ outy += 16;outu +=8; outv +=8;
+ pic0 += 2 * (width - 8);
+ pic1 += 2 * (width - 8);
+ uv += width - 16;
+ }
}
-#else
-void yuv422pto420(int * out,unsigned char *pic,int width, unsigned char *uv)
+
+void yuv422pto420p(int * out, addr *pic, int width)
{
- int j, k;
- unsigned char *pic0, *pic1;
- int *outy, *outu, *outv;
- int outy1 = 0;
- int outy2 = 8;
- int outu1 = 0;
- int outv1 = 0;
-
- //yyyyuv
- pic0 = pic;
- pic1 = pic + width;
- outy = out;
- outu = out + 64 * 4;
- outv = out + 64 * 5;
- for (j = 0; j < 4; j++)
- {
- for (k = 0; k < 8; k++)
- {
- if( k == 4)
- {
- outy1 += 56;
- outy2 += 56;
- }
- *pic0++ = CLIP(outy[outy1]); //y1 line 1
- *pic0++ = CLIP(outy[outy1+1]); //y2 line 1
- *pic1++ = CLIP(outy[outy2]); //y1 line 2
- *pic1++ = CLIP(outy[outy2+1]); //y2 line 2
+ int j, k;
+ unsigned char *pic0, *pic1,*v,*u;
+ int *outy, *outu, *outv;
+ int *outy1 ;
+ int *outy2 ;
+ int *outu1 ;
+ int *outv1 ;
+
+ //yyyyuv
+ pic0 = pic->y;
+ pic1 = pic->y + width;
+ v = pic->v;
+ u = pic->u;
+ outy = out;
+ outu = out + 64 * 4;
+ outv = out + 64 * 5;
+ for (j = 0; j < 4; j++)
+ {
+ outy1 = outy;
+ outy2 = outy+8;
+ outv1 = outv;
+ outu1 = outu;
+
+ for (k = 0; k < 2; k++)
+ {
+ asm volatile(
+ "mov r0,#0 \n\t"
+ "vdup.u32 d30, r0 \n\t"
+ "mov r0,#255 \n\t"
+ "vdup.u32 d31, r0 \n\t"
- *uv++ = CLIP(128 + outv[outv1]); //v line 1
- *uv++ = CLIP(128 + outu[outu1]); //u line 1
- outv1 += 1; outu1 += 1;
- outy1 +=2; outy2 +=2;
- }
- outy += 16;outu +=8; outv +=8;
- outv1 = 0; outu1=0;
- outy1 = 0;
- outy2 = 8;
- pic0 += 2 * (width - 8);
- pic1 += 2 * (width - 8);
- uv += width - 16;
- }
+ /////////////////////////////line1
+ "mov r0, #256 @256=64*4\n\t"
+ "vld4.32 {d26,d27,d28,d29}, [%[outy1]], r0 \n\t"
+ "vmax.s32 d26, d26, d30 \n\t"
+ "vmin.s32 d26, d26, d31 \n\t"
+ "vmax.s32 d27, d27, d30 \n\t"
+ "vmin.s32 d27, d27, d31 \n\t"
+ "vmax.s32 d28, d28, d30 \n\t"
+ "vmin.s32 d28, d28, d31 \n\t"
+ "vmax.s32 d29, d29, d30 \n\t"
+ "vmin.s32 d29, d29, d31 \n\t"
+ "vst4.8 {d26[0],d27[0],d28[0],d29[0]}, [%[pic0]]! \n\t"
+ "vst4.8 {d26[4],d27[4],d28[4],d29[4]}, [%[pic0]]! \n\t"
+
+ /////////////////////////////line2
+ "vld4.32 {d26,d27,d28,d29}, [%[outy2]],r0 \n\t"
+ "vmax.s32 d26, d26, d30 \n\t"
+ "vmin.s32 d26, d26, d31 \n\t"
+ "vmax.s32 d27, d27, d30 \n\t"
+ "vmin.s32 d27, d27, d31 \n\t"
+ "vmax.s32 d28, d28, d30 \n\t"
+ "vmin.s32 d28, d28, d31 \n\t"
+ "vmax.s32 d29, d29, d30 \n\t"
+ "vmin.s32 d29, d29, d31 \n\t"
+ "vst4.8 {d26[0],d27[0],d28[0],d29[0]}, [%[pic1]]! \n\t"
+ "vst4.8 {d26[4],d27[4],d28[4],d29[4]}, [%[pic1]]! \n\t"
+
+ //////////////////////////////uv
+ "mov r0, #16 @16=4*4 \n\t"
+ "vld4.32 {d22,d23,d24,d25}, [%[outv1]], r0 \n\t"
+ "vld4.32 {d26,d27,d28,d29}, [%[outu1]], r0 \n\t"
+
+ "mov r0, #128 \n\t"
+ "vdup.u32 d30, r0 \n\t"
+ "vqadd.s32 d22, d22, d30 \n\t"
+ "vqadd.s32 d23, d23, d30 \n\t"
+ "vqadd.s32 d24, d24, d30 \n\t"
+ "vqadd.s32 d25, d25, d30 \n\t"
+ "vqadd.s32 d26, d26, d30 \n\t"
+ "vqadd.s32 d27, d27, d30 \n\t"
+ "vqadd.s32 d28, d28, d30 \n\t"
+ "vqadd.s32 d29, d29, d30 \n\t"
+
+ "mov r0, #0 \n\t"
+ "vdup.u32 d30, r0 \n\t"
+
+ "vmax.s32 d22, d22, d30 \n\t"
+ "vmin.s32 d22, d22, d31 \n\t"
+ "vmax.s32 d24, d24, d30 \n\t"
+ "vmin.s32 d24, d24, d31 \n\t"
+ "vmax.s32 d26, d26, d30 \n\t"
+ "vmin.s32 d26, d26, d31 \n\t"
+ "vmax.s32 d28, d28, d30 \n\t"
+ "vmin.s32 d28, d28, d31 \n\t"
+
+ "vmax.s32 d23, d23, d30 \n\t"
+ "vmin.s32 d23, d23, d31 \n\t"
+ "vmax.s32 d25, d25, d30 \n\t"
+ "vmin.s32 d25, d25, d31 \n\t"
+ "vmax.s32 d27, d27, d30 \n\t"
+ "vmin.s32 d27, d27, d31 \n\t"
+ "vmax.s32 d29, d29, d30 \n\t"
+ "vmin.s32 d29, d29, d31 \n\t"
+ "vst4.8 {d22[0],d23[0],d24[0],d25[0]}, [%[v]]! \n\t"
+ "vst4.8 {d26[0],d27[0],d28[0],d29[0]}, [%[u]]! \n\t"
+ //////////////////////////////
+ "4:@end \n\t"
+ : [outy1] "+r" (outy1), [outy2] "+r" (outy2),
+ [pic0] "+r" (pic0), [pic1] "+r" (pic1),
+ [outu1] "+r" (outu1), [outv1] "+r" (outv1),
+ [v] "+r" (v),[u] "+r" (u)
+ : [width] "r" (width)
+ : "cc", "memory", "r0","r1", "r2", "r4", "q0", "q1"
+ );
+ }
+ outy += 16;outu +=8; outv +=8;
+ pic0 += 2 * (width - 8);
+ pic1 += 2 * (width - 8);
+ v += width/2 - 8;
+ u += width/2 - 8;
+ }
}
-#endif
+
/*use in utils.c for jpeg decoding 444 planar to 422
* args:
* out: pointer to data output of idct (macroblocks yyyy u v)
diff --git a/mjpeg/jpegdec.c b/mjpeg/jpegdec.c
index cfecaf4..381b666 100755
--- a/mjpeg/jpegdec.c
+++ b/mjpeg/jpegdec.c
@@ -64,7 +64,7 @@ inline static void idct(int *in, int *out, int *quant, long off, int max);
/*********************************/
//static void col221111 __P((int *, unsigned char *, int));
-typedef void (*ftopict) (int * out, BYTE *pic, int width) ;
+typedef void (*ftopict) (int * out, addr *pic, int width) ;
/*********************************/
static BYTE *datap;
@@ -228,7 +228,7 @@ static int dec_checkmarker(void)
* with: picture width
* height: picture height
*/
-int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outformat)
+int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height, unsigned int outformat)
{
struct jpeg_decdata *decdata;
int i=0, j=0, m=0, tac=0, tdc=0;
@@ -395,6 +395,7 @@ int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outfor
goto error;
}
+ int stride = 0;
switch (dscans[0].hv)
{
case 0x22: // 411
@@ -405,7 +406,9 @@ int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outfor
xpitch = 16 * bpp;
pitch = width * bpp; // YUYV out
ypitch = 16 * pitch;
- convert = yuv420pto422; //choose the right conversion function
+ //convert = yuv420pto422; //choose the right conversion function
+ err = ERR_NOT_SUPPORTED;
+ goto error;
break;
case 0x21: //422
mb=4;
@@ -415,7 +418,13 @@ int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outfor
xpitch = 16 * bpp;
pitch = width * bpp; // YUYV out
ypitch = 8 * pitch;
- convert = yuv422pto422; //choose the right conversion function
+ if(outformat == V4L2_PIX_FMT_NV21){
+ convert = yuv422pto420sp; //choose the right conversion function
+ stride = 2;
+ }else{
+ convert = yuv422pto420p;
+ stride = 4;
+ }
break;
case 0x11: //444
mcusx = width >> 3;
@@ -427,20 +436,23 @@ int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outfor
if (info.ns==1)
{
mb = 1;
- convert = yuv400pto422; //choose the right conversion function
+ //convert = yuv400pto422; //choose the right conversion function
}
else
{
mb=3;
- convert = yuv444pto422; //choose the right conversion function
+ //convert = yuv444pto422; //choose the right conversion function
}
+ err = ERR_NOT_SUPPORTED;
+ goto error;
break;
default:
err = ERR_NOT_YCBCR_221111;
goto error;
break;
}
-
+
+ addr paddr;
idctqtab(quant[dscans[0].tq], decdata->dquant[0]);
idctqtab(quant[dscans[1].tq], decdata->dquant[1]);
idctqtab(quant[dscans[2].tq], decdata->dquant[2]);
@@ -507,7 +519,11 @@ int jpeg_decode(BYTE **pic, BYTE *buf, int width, int height,unsigned int outfor
IFIX(128.5), max[0]);
break;
} // switch enc411
- yuv422pto420(decdata->out,*pic+my*width*8+mx*16,width,*pic+width*height+my*width*8/2+mx*16); //convert to 420
+
+ paddr.y = *pic+my*width*8+mx*16;
+ paddr.v = *pic+width*height+my*width*8/stride+mx*32/stride;
+ paddr.u = *pic+width*height*5/4+my*width*8/stride+mx*32/stride;
+ convert(decdata->out,&paddr,width);
}
}