diff options
Diffstat (limited to 'src/pnw_MPEG4.c')
-rw-r--r-- | src/pnw_MPEG4.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/pnw_MPEG4.c b/src/pnw_MPEG4.c index c6c87d5..94c442b 100644 --- a/src/pnw_MPEG4.c +++ b/src/pnw_MPEG4.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011 Intel Corporation. All Rights Reserved. - * Copyright (c) Imagination Technologies Limited, UK + * Copyright (c) Imagination Technologies Limited, UK * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -9,11 +9,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -52,6 +52,8 @@ #define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val; #define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3])) #define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val; +#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate; +#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5]) #define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType") @@ -105,7 +107,7 @@ typedef enum { /* Format is: opcode, width, symbol. All VLC tables are concatenated. */ #define VLC_PACK(a,b,c) ( ( (a) << 12 ) | ( (b) << 9 ) | (c) ) -const static IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = { +static const IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = { VLC_PACK(4 , 0 , 12), VLC_PACK(5 , 0 , 7), VLC_PACK(4 , 2 , 13), VLC_PACK(4 , 3 , 16), VLC_PACK(5 , 0 , 9), VLC_PACK(4 , 5 , 17), VLC_PACK(2 , 2 , 1), VLC_PACK(3 , 2 , 0), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 2 , 36), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 0 , 0), VLC_PACK(0 , 0 , 6), VLC_PACK(0 , 0 , 7), VLC_PACK(2 , 1 , 8), VLC_PACK(0 , 1 , 10), VLC_PACK(2 , 1 , 13), VLC_PACK(0 , 2 , 15), @@ -509,7 +511,7 @@ static VAStatus pnw_MPEG4_CreateContext( DEBUG_FAILURE; } if (vaStatus == VA_STATUS_SUCCESS) { - void *vlc_packed_data_address; + unsigned char *vlc_packed_data_address; if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) { memcpy(vlc_packed_data_address, gaui16mpeg4VlcTableDataPacked, sizeof(gaui16mpeg4VlcTableDataPacked)); psb_buffer_unmap(&ctx->vlc_packed_table); @@ -622,11 +624,14 @@ static VAStatus psb__MPEG4_process_picture_param(context_MPEG4_p ctx, object_buf case PICTURE_CODING_P: ctx->forward_ref_surface = SURFACE(ctx->pic_params->forward_reference_picture); ctx->backward_ref_surface = NULL; - if (NULL == ctx->forward_ref_surface) { + + if (ctx->pic_params->forward_reference_picture == VA_INVALID_SURFACE) + ctx->forward_ref_surface = NULL; + if (NULL == ctx->forward_ref_surface && ctx->pic_params->forward_reference_picture != VA_INVALID_SURFACE) { return VA_STATUS_ERROR_INVALID_SURFACE; } psb__information_message("PICTURE_CODING_P\nTarget surface = %08x (%08x)\n", ctx->obj_context->current_render_target->psb_surface, ctx->obj_context->current_render_target->base.id); - psb__information_message("Forward ref = %08x (%08x)\n", ctx->forward_ref_surface->psb_surface, ctx->pic_params->forward_reference_picture); + psb__information_message("Forward ref = %08x (%08x)\n", (ctx->forward_ref_surface ? ctx->forward_ref_surface->psb_surface : 0), ctx->pic_params->forward_reference_picture); psb__information_message("Backward ref = NULL\n"); break; @@ -874,7 +879,7 @@ static VAStatus psb__MPEG4_add_slice_param(context_MPEG4_p ctx, object_buffer_p { ASSERT(obj_buffer->type == VASliceParameterBufferType); if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) { - void *new_list; + unsigned char *new_list; ctx->slice_param_list_size += 8; new_list = realloc(ctx->slice_param_list, sizeof(object_buffer_p) * ctx->slice_param_list_size); @@ -953,7 +958,12 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx) psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate; object_context_p obj_context = ctx->obj_context; - if (rotate_surface->extra_info[5] != obj_context->rotate) + if (rotate_surface == NULL) { + psb__information_message("rotate surface is NULL, abort msvdx rotation\n"); + return; + } + + if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate) psb__error_message("Display rotate mode does not match surface rotate mode!\n"); @@ -971,7 +981,7 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx) REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */ - REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]); + REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface)); psb_cmdbuf_rendec_write(cmdbuf, cmd); @@ -1016,7 +1026,7 @@ static void psb__MPEG4_set_picture_params(context_MPEG4_p ctx, VASliceParameterB } psb_cmdbuf_rendec_end(cmdbuf); - if (ctx->obj_context->rotate != VA_ROTATION_NONE) + if (CONTEXT_ROTATE(ctx->obj_context)) psb__MPEG4_setup_alternative_frame(ctx); /* Send VDMC and VDEB commands */ @@ -1382,7 +1392,7 @@ static VAStatus psb__MPEG4_process_slice_data(context_MPEG4_p ctx, object_buffer VAStatus vaStatus = VA_STATUS_SUCCESS; VASliceParameterBufferMPEG4 *slice_param; int buffer_idx = 0; - int element_idx = 0; + unsigned int element_idx = 0; ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType)); |