3931|3

1

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

s3c6410解码问题 [复制链接]

我使用的友坚的UT-6410开发板,linux内核版本是2.6.28,7英寸LCD。我使用友坚自带的MFC测试程序(他们不提供源代码)UT_MultiMedia_test_800_480,能正常解码。我到网上下载了Multimedia_DD,编译通过,拷贝在开发板上运行,出现“Size is too big to be supported”错误。后发现错误在urbetter-linux2.6.28-v1.0\drivers\media\video\samsung\post\s3c_pp_6400.c下,

// S3C6410 support that the source image is up to 4096 x 4096
//     and the destination image is up to 2048 x 2048.
                            if (    (temp_src_width > 4096) || (temp_src_height > 4096)
                     || (temp_dst_width > 2048) || (temp_dst_height > 2048) )
                            {
                                    printk(KERN_ERR "\n%s: Size is too big to be supported.\n", __FUNCTION__);
                                    mutex_unlock(h_mutex);
                                    return -EINVAL;
                            }
但是,我的视频文件时三星自带的,不可能超过4096 x 4096,后来我把这段代码注释掉,能运行,但是出现黑白屏。我以为是友坚编译的内核出问题,我自己又编译了一次,还是出现同类问题,但是,友坚自带的UT_MultiMedia_test_800_480测试代码,却正常。郁闷!

我的测试代码如下(三星的,我没有修改)
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

#include "SsbSipH264Decode.h"
#include "SsbSipMpeg4Decode.h"
#include "SsbSipVC1Decode.h"
#include "FrameExtractor.h"
#include "MPEG4Frames.h"
#include "H263Frames.h"
#include "H264Frames.h"
#include "VC1Frames.h"
#include "LogMsg.h"
#include "performance.h"
#include "post.h"
#include "lcd.h"
#include "MfcDriver.h"
#include "FileRead.h"

//#define H264_INPUT_FILE                "./TestVectors/veggie.264"
#define H264_INPUT_FILE                "./TestVectors/wanted.264"
#define MPEG4_INPUT_FILE        "./TestVectors/shrek.m4v"
#define H263_INPUT_FILE                "./TestVectors/iron.263"
#define        VC1_INPUT_FILE                "./TestVectors/test2_0.rcv"

static unsigned char delimiter_mpeg4[3] = {0x00, 0x00, 0x01};
static unsigned char delimiter_h264[4]  = {0x00, 0x00, 0x00, 0x01};


#define INPUT_BUFFER_SIZE                (204800)

static void                        *handle;
static int                        in_fd;
static int                        file_size;
static char                        *in_addr;
static int                        fb_size;
static int                        pp_fd, fb_fd;
static char                        *fb_addr;       

static void sig_del_h264(int signo);
static void sig_del_mpeg4(int signo);
static void sig_del_vc1(int signo);


int Test_Display_H264(int argc, char **argv)
{
       
        void                        *pStrmBuf;
        int                                nFrameLeng = 0;
        unsigned int        pYUVBuf[2];
       
        struct stat                                s;
        FRAMEX_CTX                                *pFrameExCtx;        // frame extractor context
        FRAMEX_STRM_PTR                 file_strm;
        SSBSIP_H264_STREAM_INFO stream_info;       
       
        pp_params        pp_param;
        s3c_win_info_t        osd_info_to_driver;

        struct fb_fix_screeninfo        lcd_info;               
       
#ifdef FPS
        struct timeval        start, stop;
        unsigned int        time = 0;
        int                                frame_cnt = 0;
        int                                mod_cnt = 0;
#endif

        if(signal(SIGINT, sig_del_h264) == SIG_ERR) {
                printf("Sinal Error\n");
        }

        // in file open
        in_fd        = open(H264_INPUT_FILE, O_RDONLY);
        if(in_fd < 0) {
                printf("Input file open failed\n");
                return -1;
        }

        // get input file size
        fstat(in_fd, &s);
        file_size = s.st_size;
       
        // mapping input file to memory
        in_addr = (char *)mmap(0, file_size, PROT_READ, MAP_SHARED, in_fd, 0);
        if(in_addr == NULL) {
                printf("input file memory mapping failed\n");
                return -1;
        }
       
        // Post processor open
        pp_fd = open(PP_DEV_NAME, O_RDWR|O_NDELAY);
        if(pp_fd < 0)
        {
                printf("Post processor open error\n");
                return -1;
        }

        // LCD frame buffer open
        fb_fd = open(FB_DEV_NAME, O_RDWR|O_NDELAY);
        if(fb_fd < 0)
        {
                printf("LCD frame buffer open error\n");
                return -1;
        }

        ///////////////////////////////////
        // FrameExtractor Initialization //
        ///////////////////////////////////
        pFrameExCtx = FrameExtractorInit(FRAMEX_IN_TYPE_MEM, delimiter_h264, sizeof(delimiter_h264), 1);   
        file_strm.p_start = file_strm.p_cur = (unsigned char *)in_addr;
        file_strm.p_end = (unsigned char *)(in_addr + file_size);
        FrameExtractorFirst(pFrameExCtx, &file_strm);
       

        //////////////////////////////////////
        ///    1. Create new instance      ///
        ///      (SsbSipH264DecodeInit)    ///
        //////////////////////////////////////
        handle = SsbSipH264DecodeInit();
        if (handle == NULL) {
                printf("H264_Dec_Init Failed.\n");
                return -1;
        }

        /////////////////////////////////////////////
        ///    2. Obtaining the Input Buffer      ///
        ///      (SsbSipH264DecodeGetInBuf)       ///
        /////////////////////////////////////////////
        pStrmBuf = SsbSipH264DecodeGetInBuf(handle, nFrameLeng);
        if (pStrmBuf == NULL) {
                printf("SsbSipH264DecodeGetInBuf Failed.\n");
                SsbSipH264DecodeDeInit(handle);
                return -1;
        }

        ////////////////////////////////////
        //  H264 CONFIG stream extraction //
        ////////////////////////////////////
        nFrameLeng = ExtractConfigStreamH264(pFrameExCtx, &file_strm, pStrmBuf, INPUT_BUFFER_SIZE, NULL);


        ////////////////////////////////////////////////////////////////
        ///    3. Configuring the instance with the config stream    ///
        ///       (SsbSipH264DecodeExe)                             ///
        ////////////////////////////////////////////////////////////////
        if (SsbSipH264DecodeExe(handle, nFrameLeng) != SSBSIP_H264_DEC_RET_OK) {
                printf("H.264 Decoder Configuration Failed.\n");
                return -1;
        }


        /////////////////////////////////////
        ///   4. Get stream information   ///
        /////////////////////////////////////
        SsbSipH264DecodeGetConfig(handle, H264_DEC_GETCONF_STREAMINFO, &stream_info);

//        printf("\t width=%d   height=%d.\n", stream_info.width, stream_info.height);

        // set post processor configuration
        pp_param.SrcFullWidth        = 100;//stream_info.width;
        pp_param.SrcFullHeight        = 200;stream_info.height;
        pp_param.SrcStartX                = 0;
        pp_param.SrcStartY                = 0;
        pp_param.SrcWidth                = pp_param.SrcFullWidth;
        pp_param.SrcHeight                = pp_param.SrcFullHeight;
        pp_param.SrcCSpace                = YC420;
        pp_param.DstStartX                = 0;
        pp_param.DstStartY                = 0;
        pp_param.DstFullWidth        =  800;                // destination width
        pp_param.DstFullHeight        = 480;                // destination height
        pp_param.DstWidth                = pp_param.DstFullWidth;
        pp_param.DstHeight                = pp_param.DstFullHeight;
        pp_param.DstCSpace                = RGB16;
#ifdef RGB24BPP
        pp_param.DstCSpace                = RGB24;
#endif
        pp_param.OutPath                = POST_DMA;
        pp_param.Mode                        = ONE_SHOT;
       

        // get LCD frame buffer address
        fb_size = pp_param.DstFullWidth * pp_param.DstFullHeight * 2;        // RGB565
#ifdef RGB24BPP
        fb_size = pp_param.DstFullWidth * pp_param.DstFullHeight * 4;        // RGB888
#endif

        fb_addr = (char *)mmap(0, fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, fb_fd, 0);
        if (fb_addr == NULL) {
                printf("LCD frame buffer mmap failed\n");
                return -1;
        }

        osd_info_to_driver.Bpp                        = 16;        // RGB16
#ifdef RGB24BPP
        osd_info_to_driver.Bpp                        = 24;        // RGB16
#endif
        osd_info_to_driver.LeftTop_x        = 0;       
        osd_info_to_driver.LeftTop_y        = 0;
        osd_info_to_driver.Width                =  800;        // display width
        osd_info_to_driver.Height                =  480;        // display height

        // set OSD's information
        if(ioctl(fb_fd, SET_OSD_INFO, &osd_info_to_driver)) {
                printf("Some problem with the ioctl SET_OSD_INFO\n");
                return -1;
        }

        ioctl(fb_fd, SET_OSD_START);

        printf("\n[1. H.264 display]\n");
        printf("Using IP          : MFC, Post processor, LCD\n");
        printf("Input filename    : wanted.264\n");
        printf("Input vector size : VGA(640x480)\n");
        printf("Display size      : WVGA(800x480)\n");
        printf("Bitrate           : 971 Kbps\n");
        printf("FPS               : 30\n");
       

        while(1)
        {

        #ifdef FPS
                gettimeofday(&start, NULL);
        #endif
       
                //////////////////////////////////
                ///       5. DECODE            ///
                ///    (SsbSipH264DecodeExe)   ///
                //////////////////////////////////
                if (SsbSipH264DecodeExe(handle, nFrameLeng) != SSBSIP_H264_DEC_RET_OK)
                        break;
       
       
                //////////////////////////////////////////////
                ///    6. Obtaining the Output Buffer      ///
                ///      (SsbSipH264DecodeGetOutBuf)       ///
                //////////////////////////////////////////////
                SsbSipH264DecodeGetConfig(handle, H264_DEC_GETCONF_PHYADDR_FRAM_BUF, pYUVBuf);

       
                /////////////////////////////
                // Next H.264 VIDEO stream //
                /////////////////////////////
                nFrameLeng = NextFrameH264(pFrameExCtx, &file_strm, pStrmBuf, INPUT_BUFFER_SIZE, NULL);
                if (nFrameLeng < 4)
                        break;
                                       
                // Post processing
                // pp_param.SrcFrmSt俊绰 MFC狼 output buffer狼 physical address啊
                // pp_param.DstFrmSt俊绰 LCD frame buffer狼 physical address啊 涝仿栏肺 持绢具 茄促.
                pp_param.SrcFrmSt                = pYUVBuf[0];        // MFC output buffer
                ioctl(fb_fd, FBIOGET_FSCREENINFO, &lcd_info);
                pp_param.DstFrmSt                = lcd_info.smem_start;                        // LCD frame buffer
                ioctl(pp_fd, PPROC_SET_PARAMS, &pp_param);
                ioctl(pp_fd, PPROC_START);       


        #ifdef FPS
                gettimeofday(&stop, NULL);
                time += measureTime(&start, &stop);
                frame_cnt++;
                mod_cnt++;
                if (mod_cnt == 50) {
                        printf("Average FPS : %u\n", (float)mod_cnt*1000/time);
                        mod_cnt = 0;
                        time = 0;
                }
        #endif
       
       
        }

#ifdef FPS
        printf("Display Time : %u, Frame Count : %d, FPS : %f\n", time, frame_cnt, (float)frame_cnt*1000/time);
#endif

        ioctl(fb_fd, SET_OSD_STOP);
        SsbSipH264DecodeDeInit(handle);

        munmap(in_addr, file_size);
        munmap(fb_addr, fb_size);
        close(pp_fd);
        close(fb_fd);
        close(in_fd);
       
        return 0;
}




static void sig_del_h264(int signo)
{
        printf("[H.264 display] signal handling\n");

        ioctl(fb_fd, SET_OSD_STOP);
        SsbSipH264DecodeDeInit(handle);

        munmap(in_addr, file_size);
        munmap(fb_addr, fb_size);
        close(pp_fd);
        close(fb_fd);
        close(in_fd);

        exit(1);
}

请问各位高手,帮忙解决一下。谢谢!

最新回复

我发现28的post的结构体与24的post发生的变化。如下: 这是28的: typedef struct { unsigned int src_full_width; // Source Image Full Width (Virtual screen size) unsigned int src_full_height; // Source Image Full Height (Virtual screen size) unsigned int src_start_x; // Source Image Start width offset unsigned int src_start_y; // Source Image Start height offset unsigned int src_width; // Source Image Width unsigned int src_height; // Source Image Height unsigned int src_buf_addr_phy; // Base Address of the Source Image : Physical Address unsigned int src_next_buf_addr_phy; // Base Address of Source Image to be displayed next time in FIFO_FREERUN Mode s3c_color_space_t src_color_space; // Color Space of the Source Image unsigned int dst_full_width; // Destination Image Full Width (Virtual screen size) unsigned int dst_full_height; // Destination Image Full Height (Virtual screen size) unsigned int dst_start_x; // Destination Image Start width offset unsigned int dst_start_y; // Destination Image Start height offset unsigned int dst_width; // Destination Image Width unsigned int dst_height; // Destination Image Height unsigned int dst_buf_addr_phy; // Base Address of the Destination Image : Physical Address s3c_color_space_t dst_color_space; // Color Space of the Destination Image s3c_pp_out_path_t out_path; // output and run mode (DMA_ONESHOT or FIFO_FREERUN)   s3c_pp_scan_mode_t scan_mode; // INTERLACE_MODE, PROGRESSIVE_MODE } s3c_pp_params_t 这是24的: typedef struct{ unsigned int SrcFullWidth; // Source Image Full Width(Virtual screen size) unsigned int SrcFullHeight; // Source Image Full Height(Virtual screen size) unsigned int SrcStartX; // Source Image Start width offset unsigned int SrcStartY; // Source Image Start height offset unsigned int SrcWidth; // Source Image Width unsigned int SrcHeight; // Source Image Height unsigned int SrcFrmSt; // Base Address of the Source Image : Physical Address cspace_t SrcCSpace; // Color Space ot the Source Image unsigned int DstFullWidth; // Source Image Full Width(Virtual screen size) unsigned int DstFullHeight; // Source Image Full Height(Virtual screen size) unsigned int DstStartX; // Source Image Start width offset unsigned int DstStartY; // Source Image Start height offset unsigned int DstWidth; // Source Image Width unsigned int DstHeight; // Source Image Height unsigned int DstFrmSt; // Base Address of the Source Image : Physical Address cspace_t DstCSpace; // Color Space ot the Source Image unsigned int SrcFrmBufNum; // Frame buffer number s3c_pp_run_mode_t Mode; // POST running mode(PER_FRAME or FREE_RUN) s3c_pp_path_t InPath; // Data path of the source image s3c_pp_path_t OutPath; // Data path of the desitination image unsigned int in_pixel_size; // source format size per pixel unsigned int out_pixel_size; // destination format size per pixel }pp_params; 而我使用的Multimedia_DD是24是内核的,所以在应用层传参给内核驱动时,出现不配套: // set post processor configuration pp_param.SrcFullWidth = 100;//stream_info.width; pp_param.SrcFullHeight = 200;stream_info.height; pp_param.SrcStartX = 0; pp_param.SrcStartY = 0; pp_param.SrcWidth = pp_param.SrcFullWidth; pp_param.SrcHeight = pp_param.SrcFullHeight; pp_param.SrcCSpace = YC420; pp_param.DstStartX = 0; pp_param.DstStartY = 0; pp_param.DstFullWidth = 800; // destination width pp_param.DstFullHeight = 480; // destination height pp_param.DstWidth = pp_param.DstFullWidth; pp_param.DstHeight = pp_param.DstFullHeight; pp_param.DstCSpace = RGB16; #ifdef RGB24BPP pp_param.DstCSpace = RGB24; #endif pp_param.OutPath = POST_DMA; pp_param.Mode = ONE_SHOT; 就会出现:   // S3C6410 support that the source image is up to 4096 x 4096   // and the destination image is up to 2048 x 2048.   if ( (temp_src_width > 4096) || (temp_src_height > 4096)     || (temp_dst_width > 2048) || (temp_dst_height > 2048) )   {   printk(KERN_ERR "\n%s: Size is too big to be supported.\n", __FUNCTION__);   mutex_unlock(h_mutex);   return -EINVAL;     的问题; 请问哪位有28的应用层BSP包?  详情 回复 发表于 2010-6-4 09:03
点赞 关注

回复
举报

1

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
没看出有什么问题,帮顶下
 
 

回复

80

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
谢谢!我使用的linux2.6.28内核,而自己编译的测试程序是基于linux2.6.24内核的BSP包。后来,发现28与24的PP结构体发生很大变化,造成我在应用层传给内核的内容部匹配,造成错误。所以,现在正修改24BSP包。不知道哪位有28的应用层BSP包?能否给予一份。谢谢!
 
 
 

回复

1

帖子

0

TA的资源

禁止访问

4
 
提示: 作者被禁止或删除 内容自动屏蔽
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表