AnsweredAssumed Answered

h.264 encoder lost half of image, strange problem

Question asked by Hong on Oct 15, 2012
Latest reply on Oct 31, 2012 by Hong

Hi, the h.264 baseline encoder SDK produces strange result as the following sample. I have no idea how this happened..

 

samples.png

I checked the setting and found that this phenomenon appeared when pvc->scaling was set to H_V_HALF. If I set pvc->scaling = 0, it works right.

 

My initial code is as follows,

 

init_encoder_settings_cmos_vga

// Interface for CMOS sensors

void init_encoder_settings_cmos_vga(vidcodec_t *pvc)

{

          pvc->bitrate = 1000000;   

          pvc->frame_slice_num = 1;

          pvc->disable_deblocking_filter_idc = 2;

          pvc->slice_alpha_c0_offset_div2 = 0;

          pvc->slice_beta_offset_div2 = 0;

          pvc->frame_type = -2;

          pvc->search_complexity  = 0x6A132297;

          pvc->sc_detect_flag = 0x10038932;

          pvc->rc_control = 0x0A42ccf5;

          pvc->pos_x = 0; 

          pvc->pos_y = 0;

          pvc->fixedQP = 0;  

          pvc->splitframe = 0;

          pvc->field_pic_flag = 0;  

          pvc->profile_idc = BASELINE_PROFILE;

          pvc->ccir_deinterlace = 1;

          pvc->chk_for_dma_err = 0;

          pvc->bframecnt = 0;

          pvc->mbquant_flag = 0;    

          pvc->cabac_flag = 0;

          pvc->enable_constant_pic_id = 0;

          pvc->enable_chksum = 0;

          pvc->enable_aspect_ratio = 0;

          pvc->windowpos = 0;

          pvc->pixel_aspect_x = -1;

          pvc->pixel_aspect_y = -1;

          pvc->is_preproc_api_used = 0;

          pvc->enable_idr = 1;

 

          // Output format

          pvc->width  = 320;

          pvc->height = 240;

          pvc->framerate = 5;

          pvc->keyframe_dist = pvc->framerate-1;

          pvc->video_standard = RAW422_PROG;

 

          // VGA input

          pvc->vid_capture_width = 640;

          pvc->vid_capture_height = 480;

          pvc->vid_capture_frate = 5;

          pvc->color_format = CCIR422;

          pvc->scaling = H_V_HALF;

 

#define DEST_DMA_CONFIG_OFFSET  0x08

#define DEST_DMA_DESC_OFFSET    0x20

#define DEST_DMA_IRQ_OFFSET     0x28

 

 

#define SRC_DMA_CONFIG_OFFSET   0x48

#define SRC_DMA_DESC_OFFSET     0x60

#define SRC_DMA_IRQ_OFFSET      0x68

 

 

          // MDMA0

          pvc->MDMA_D0CFG        = MDMA_D0_NEXT_DESC_PTR + (DEST_DMA_CONFIG_OFFSET);      

          pvc->MDMA_D0DSC        = MDMA_D0_NEXT_DESC_PTR + (DEST_DMA_DESC_OFFSET);

          pvc->MDMA_S0CFG        = MDMA_D0_NEXT_DESC_PTR + (SRC_DMA_CONFIG_OFFSET);

          pvc->MDMA_S0DSC        = MDMA_D0_NEXT_DESC_PTR + (SRC_DMA_DESC_OFFSET);

          pvc->MDMAD0_IRQ_STATUS = MDMA_D0_NEXT_DESC_PTR + (DEST_DMA_IRQ_OFFSET);

          pvc->MDMAS0_IRQ_STATUS = MDMA_D0_NEXT_DESC_PTR + (SRC_DMA_IRQ_OFFSET);

 

 

}

 

Thanks for any advice,

B.R.

Hong.

Outcomes