2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
12 /****************************************************************************
14 * Module Title : onyxdxv.c
16 * Description : VP80 interface to DXV.
18 *****************************************************************************
20 /****************************************************************************
22 ****************************************************************************/
23 #include <math.h> // For Abs()
24 #include "vp8/common/pragmas.h"
27 #include "vpxdxv_plugin.h"
29 #include "vp8/decoder/onyxd_int.h"
30 #include "vp8/common/onyx.h"
31 #include "vp8/common/codec_common_interface.h"
32 #include "vpx_scale/vpxscale.h"
33 #include "vpx_mem/vpx_mem.h"
34 #include "vp8/common/postproc.h"
35 #include "vp8/common/vpxblit.h"
36 #include "vp8/common/g_common.h"
37 #include "vpx_scale/yv12extend.h"
41 #include "scale_mode.h"
42 #include "onyx_pb_interface.h"
44 /****************************************************************************
46 ****************************************************************************/
48 #define VP8_FOURCC DXL_MKFOURCC( 'V', 'P', '8', '0')
50 extern void vp8_blit_text(const char *msg
, unsigned char *address
, const int pitch
);
53 /****************************************************************************
55 ****************************************************************************/
57 typedef struct // YUV buffer configuration structure
75 unsigned char *y_ptr_scrn
;
76 unsigned char *u_ptr_scrn
;
77 unsigned char *v_ptr_scrn
;
80 } DXV_YUV_BUFFER_CONFIG
;
83 typedef void ((*vp8blit_func
)(unsigned char *, int, YUV_BUFFER_CONFIG
*));
85 /* define an x_image structure based on the core x_image struct */
86 typedef struct t_ximage_codec
88 DXV_YUV_BUFFER_CONFIG frame_buffer
;
92 int decompressed_once
;
99 unsigned int *supported_output_format_list
;
113 YV12_BUFFER_CONFIG this_buffer
;
114 YV12_BUFFER_CONFIG scaled_buffer
;
115 YV12_BUFFER_CONFIG
*passed_in_buffer
;
121 } VP8_XIMAGE
, *VP8_XIMAGE_HANDLE
;
124 /****************************************************************************
126 ****************************************************************************/
127 static unsigned int g_vp8_preferred_output_format_list
[] =
145 /****************************************************************************
146 * Forward declarationss
147 ****************************************************************************/
148 void onyx_set_parameter(XIMAGE_HANDLE src
, int Command
, unsigned int Parameter
);
150 static int onyx_get_output_format(XIMAGE_HANDLE src
, unsigned int *bd_tag
);
151 static int onyx_set_output_format(XIMAGE_HANDLE src
, unsigned int bd_tag
);
153 static int vpx_get_size_of_pixel(unsigned int bd
);
155 /****************************************************************************
157 ****************************************************************************/
159 #define __Clamp255(x) (unsigned char) ( (x) < 0 ? 0 : ( (x) <= 255 ? (x) : 255 ) )
162 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170 convert_yv12_buffer_types(YV12_BUFFER_CONFIG
*source
, DXV_YUV_BUFFER_CONFIG
*dest
)
172 dest
->y_buffer
= (char *)source
->y_buffer
;
173 dest
->u_buffer
= (char *)source
->u_buffer
;
174 dest
->v_buffer
= (char *)source
->v_buffer
;
175 dest
->y_width
= source
->y_width
;
176 dest
->y_height
= source
->y_height
;
177 dest
->y_stride
= source
->y_stride
;
178 dest
->uv_width
= source
->uv_width
;
179 dest
->uv_height
= source
->uv_height
;
180 dest
->uv_stride
= source
->uv_stride
;
184 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192 VSCREEN_HANDLE v_screen
,
193 DXV_YUV_BUFFER_CONFIG
*frame_buffer
,
198 VP8_XIMAGE_HANDLE tab
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
200 VP8_COMMON
*common
= tab
->common
;
203 if (v_screen
) /* if there is a v_screen, blit to it */
205 unsigned char *ptr_scrn
;
206 int this_pitch
, vs_height
, vs_width
;
207 unsigned int start_tick
, stop_tick
;
209 vpxdxv_get_vscreen_attributes(v_screen
, (void **)&ptr_scrn
, &vs_width
, &vs_height
, &this_pitch
);
216 int view_x
, view_y
, view_w
;
220 int microseconds_available
= (int)(1000000 / 30);
222 microseconds_available
= microseconds_available
* tab
->cpu_free
/ 100;
226 microseconds_available
-= pbi
->decode_microseconds
;
228 if (tab
->cpu_free
== 0)
229 microseconds_available
= INT_MAX
;
231 if (tab
->post_proc2time
== 0)
232 tab
->post_proc2time
= pbi
->decode_microseconds
* 1 / 2;
234 if (tab
->post_proc4time
== 0)
235 tab
->post_proc4time
= pbi
->decode_microseconds
;
239 if (tab
->ppcount
== 0)
241 tab
->post_proc2time
= 0;
242 tab
->post_proc4time
= 0;
250 vpxdxv_get_vscreen_view(v_screen
, &view_x
, &view_y
, &view_w
, NULL
);
252 Scale2Ratio(common
->horiz_scale
, &hr
, &hs
);
253 Scale2Ratio(common
->vert_scale
, &vr
, &vs
);
255 if (tab
->postproc
&& tab
->passed_in_buffer
== 0)
259 unsigned char message
[512];
261 int pp
= tab
->postproc
;
262 int q
= (tab
->avgq
+ 4) / 8;
265 vp8_clear_system_state();
271 pp
= pp
- noise
* 100;
290 if (pbi
&& (pbi
->mb
.segmentation_enabled
& SEGMENT_PF
) && tab
->deinterlace
)
292 de_interlace(common
->frame_to_show
->y_buffer
, common
->post_proc_buffer
.y_buffer
,
293 common
->post_proc_buffer
.y_width
, common
->post_proc_buffer
.y_height
,
294 common
->post_proc_buffer
.y_stride
);
296 de_interlace(common
->frame_to_show
->u_buffer
, common
->post_proc_buffer
.u_buffer
,
297 common
->post_proc_buffer
.uv_width
, common
->post_proc_buffer
.uv_height
,
298 common
->post_proc_buffer
.uv_stride
);
299 de_interlace(common
->frame_to_show
->v_buffer
, common
->post_proc_buffer
.v_buffer
,
300 common
->post_proc_buffer
.uv_width
, common
->post_proc_buffer
.uv_height
,
301 common
->post_proc_buffer
.uv_stride
);
305 if (pp
>= 10 && pp
<= 20)
307 q
= q
+ (pp
- 15) * 10;
313 start_tick
= vp8_get_high_res_timer_tick();
315 if (pp
> 3 && tab
->post_proc4time
< microseconds_available
)
317 vp8_deblock_and_de_macro_block(common
->frame_to_show
, &common
->post_proc_buffer
, q
, 1, 0);
319 stop_tick
= vp8_get_high_res_timer_tick();
322 tab
->post_proc4time
= vp8_get_time_in_micro_sec(start_tick
, stop_tick
);
325 else if (pp
> 0 && tab
->post_proc2time
< microseconds_available
)
327 vp8_deblock(common
->frame_to_show
, &common
->post_proc_buffer
, q
, 1, 0);
328 stop_tick
= vp8_get_high_res_timer_tick();
331 tab
->post_proc2time
= vp8_get_time_in_micro_sec(start_tick
, stop_tick
);
335 vp8_yv12_copy_frame(common
->frame_to_show
, &common
->post_proc_buffer
);
340 vp8_clear_system_state();
342 if (tab
->add_noise
== 1)
345 vp8_plane_add_noise(common
->post_proc_buffer
.y_buffer
,
346 common
->post_proc_buffer
.y_width
, common
->post_proc_buffer
.y_height
,
347 common
->post_proc_buffer
.y_stride
, 63 - q
, noise
);
353 #ifdef PACKET_TESTING
355 VP8_HEADER
*oh2
= (VP8_HEADER
*) pbi
->Source
;
356 sprintf(message
, "%8d %d%d%d%d%d size:%d\n",
363 vpxdxv_get_ximage_csize(src
));
366 sprintf(message
, "F:%1ldG:%1ldQ:%3ldF:%3ld,%3ldP:%d_s:%6ld,N:%d,",
367 (common
->frame_type
== KEY_FRAME
),
368 common
->refresh_golden_frame
,
370 common
->filter_level
,
373 vpxdxv_get_ximage_csize(src
), noise
);
376 vp8_blit_text(message
, common
->post_proc_buffer
.y_buffer
, common
->post_proc_buffer
.y_stride
);
379 else if (show_text
== 2)
382 unsigned char *y_ptr
;
383 YV12_BUFFER_CONFIG
*post
= &common
->post_proc_buffer
;
384 int mb_rows
= post
->y_height
>> 4;
385 int mb_cols
= post
->y_width
>> 4;
387 MODE_INFO
*mi
= common
->mi
;
389 y_ptr
= post
->y_buffer
+ 4 * post
->y_stride
+ 4;
391 // vp8_filter each macro block
392 for (i
= 0; i
< mb_rows
; i
++)
394 for (j
= 0; j
< mb_cols
; j
++)
399 sprintf(zz
, "%c", mi
[mb_index
].mbmi
.mode
+ 'a');
401 sprintf(zz
, "%c", mi
[mb_index
].mbmi
.ref_frame
+ 'a');
403 vp8_blit_text(zz
, y_ptr
, post
->y_stride
);
408 mb_index
++; //border
409 y_ptr
+= post
->y_stride
* 16 - post
->y_width
;
413 else if (show_text
== 3)
416 unsigned char *y_ptr
;
417 YV12_BUFFER_CONFIG
*post
= &common
->post_proc_buffer
;
418 int mb_rows
= post
->y_height
>> 4;
419 int mb_cols
= post
->y_width
>> 4;
421 MODE_INFO
*mi
= common
->mi
;
423 y_ptr
= post
->y_buffer
+ 4 * post
->y_stride
+ 4;
425 // vp8_filter each macro block
426 for (i
= 0; i
< mb_rows
; i
++)
428 for (j
= 0; j
< mb_cols
; j
++)
433 sprintf(zz
, "%c", '0' + i
% 10);
435 sprintf(zz
, "%c", '0' + j
% 10);
437 vp8_blit_text(zz
, y_ptr
, post
->y_stride
);
442 y_ptr
+= post
->y_stride
* 16 - post
->y_width
;
447 vpx_memcpy(&tab
->this_buffer
, &common
->post_proc_buffer
, sizeof(YV12_BUFFER_CONFIG
));
451 vpx_memcpy(&tab
->this_buffer
, common
->frame_to_show
, sizeof(YV12_BUFFER_CONFIG
));
455 /* get a frame pointer to the scaled and postprocessed reconstructed buffer */
456 if (tab
->passed_in_buffer
== 0)
458 if (common
->horiz_scale
!= NORMAL
|| common
->vert_scale
!= NORMAL
)
460 neww
= hs
* tab
->this_buffer
.y_width
/ hr
;
461 newh
= vs
* tab
->this_buffer
.y_height
/ vr
;
465 if (tab
->hs
!= hs
|| tab
->hr
!= hr
|| tab
->vs
!= vs
|| tab
->vr
!= vr
)
467 vp8_yv12_alloc_frame_buffer(&tab
->scaled_buffer
, neww
, newh
, 8);
470 vp8_yv12_scale_or_center(&tab
->this_buffer
,
472 neww
, newh
, SCALE_TO_FIT
, hs
, hr
, vs
, vr
);
474 convert_yv12_buffer_types(&tab
->scaled_buffer
, frame_buffer
);
476 cw
= hs
* common
->Width
/ hr
;
477 ch
= vs
* common
->Height
/ vr
;
482 convert_yv12_buffer_types(&tab
->this_buffer
, frame_buffer
);
490 convert_yv12_buffer_types(tab
->passed_in_buffer
, frame_buffer
);
493 tab
->passed_in_buffer
= 0;
496 frame_buffer
->y_width
= cw
;
497 frame_buffer
->y_height
= ch
;
498 frame_buffer
->uv_width
= cw
/ 2;
499 frame_buffer
->uv_height
= ch
/ 2;
501 p_size
= vpx_get_size_of_pixel(tab
->bd_tag
);
503 /* remember to offset if requested */
507 /* for planar destinations */
511 if (w
< frame_buffer
->y_width
)
513 frame_buffer
->y_width
= w
;
514 frame_buffer
->uv_width
= (w
+ 1) / 2;
517 if (h
< frame_buffer
->y_height
)
519 frame_buffer
->y_height
= h
;
520 frame_buffer
->uv_height
= (h
+ 1) / 2;
523 if (frame_buffer
->y_width
< view_w
)
524 x
+= (view_w
- frame_buffer
->y_width
) / 2;
529 if (frame_buffer
->y_height
< vs_height
)
530 y
+= (vs_height
- frame_buffer
->y_height
) / 2;
533 ptr_scrn
+= (x
* p_size
) + (y
* this_pitch
);
535 frame_buffer
->y_stride
*= -1;
536 frame_buffer
->uv_stride
*= -1;
538 if (tab
->bd_tag
== VPXDXV_YV12
|| tab
->bd_tag
== VPXDXV_I420
)
542 frame_buffer
->uv_start
= (char *)(ptr_scrn
+ abs(this_pitch
) + abs(this_pitch
) * h
/ 4 + this_pitch
/ 2);
543 frame_buffer
->uv_dst_area
= abs((this_pitch
* h
) / 4);
544 frame_buffer
->uv_used_area
= 0;
548 frame_buffer
->uv_start
= (char *)(ptr_scrn
+ (this_pitch
* h
));
549 frame_buffer
->uv_dst_area
= (((this_pitch
+ 1) / 2) * ((h
+ 1) / 2));
550 frame_buffer
->uv_used_area
= (((this_pitch
+ 1) / 2) * frame_buffer
->uv_height
);
554 if ((pbi
->mb
.segmentation_enabled
& SEGMENT_PF
) && (tab
->bd_tag
!= VPXDXV_YV12
&& tab
->bd_tag
!= VPXDXV_I420
))
556 int ypitch
= frame_buffer
->y_stride
;
557 int uvpitch
= frame_buffer
->uv_stride
;
559 frame_buffer
->y_stride
<<= 1;
560 frame_buffer
->y_height
>>= 1;
561 frame_buffer
->uv_stride
<<= 1;
562 frame_buffer
->uv_height
>>= 1;
564 ptr_scrn
+= this_pitch
;
565 frame_buffer
->y_buffer
-= ypitch
;
566 frame_buffer
->u_buffer
-= uvpitch
;
567 frame_buffer
->v_buffer
-= uvpitch
;
568 tab
->blitter(ptr_scrn
, 2 * this_pitch
, (YUV_BUFFER_CONFIG
*)(&tab
->frame_buffer
));
570 ptr_scrn
-= this_pitch
;
571 frame_buffer
->y_buffer
+= ypitch
;
572 frame_buffer
->u_buffer
+= uvpitch
;
573 frame_buffer
->v_buffer
+= uvpitch
;
574 tab
->blitter(ptr_scrn
, 2 * this_pitch
, (YUV_BUFFER_CONFIG
*)(&tab
->frame_buffer
));
579 /* blit the screen */
580 tab
->blitter(ptr_scrn
, this_pitch
, (YUV_BUFFER_CONFIG
*)(&tab
->frame_buffer
));
581 vpx_log("Decoder: Frame shown \n");
586 vpx_log("Decoder: Frame not shown scrn pointer 0\n");
589 vpx_log("Decoder: Frame not shown vscreen 0\n");
593 /****************************************************************************
595 * ROUTINE : onyx_decompress
607 ****************************************************************************/
609 int onyx_decompress(XIMAGE_HANDLE src
, VSCREEN_HANDLE v_screen
)
611 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
612 unsigned char *c_addr
;
617 c_addr
= vpxdxv_get_ximage_cdata_addr(src
);
618 c_size
= vpxdxv_get_ximage_csize(src
);
619 vpxdxv_get_ximage_xywh(src
, &x
, &y
, &w
, &h
);
621 // if we have a compressed frame decompress it ( otherwise we'll just redo
622 // the scaling and postprocessing from the last frame )
633 ret_val
= vp8d_decompress_frame((VP8D_PTR
) this_algorithm_base
->my_pbi
,
636 &this_algorithm_base
->this_buffer
,
640 f
= this_algorithm_base
->my_pbi
->common
.filter_level
* 10 / 6;
642 if (this_algorithm_base
->my_pbi
->common
.frame_type
== KEY_FRAME
)
643 this_algorithm_base
->avgq
= 8 * f
;
645 this_algorithm_base
->avgq
= this_algorithm_base
->avgq
* 7 / 8 + f
;
652 return DXV_VERSION_CONFLICT
;
661 vp8_rv
= onyx_blit(src
, v_screen
, &this_algorithm_base
->frame_buffer
, x
, y
);
667 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
668 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
671 int vp8_ximagedestroy(XIMAGE_HANDLE src
)
673 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
675 if (this_algorithm_base
)
678 vp8_yv12_de_alloc_frame_buffer(&this_algorithm_base
->scaled_buffer
);
680 /* safety check in case stopdecode was not called */
681 if (this_algorithm_base
->owned
)
682 vp8dx_remove_decompressor((VP8D_PTR
)(this_algorithm_base
->my_pbi
));
684 duck_free(this_algorithm_base
);
690 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
691 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
694 onyx_get_post_proc(XIMAGE_HANDLE src
, unsigned int *ppl
)
696 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
698 if (this_algorithm_base
)
700 *ppl
= this_algorithm_base
->ppl_tag
;
705 return DXV_NULL_BASE
;
708 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
709 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
712 onyx_set_post_proc(XIMAGE_HANDLE src
, unsigned int ppl
)
714 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
716 if (this_algorithm_base
)
718 this_algorithm_base
->ppl_tag
= ppl
;
723 return DXV_NULL_BASE
;
726 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
727 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
730 int vp8_ximagestop_decode(XIMAGE_HANDLE src
)
732 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
734 if (this_algorithm_base
)
737 vp8_yv12_de_alloc_frame_buffer(&this_algorithm_base
->scaled_buffer
);
739 if (this_algorithm_base
->owned
)
740 vp8dx_remove_decompressor((VP8D_PTR
)(this_algorithm_base
->my_pbi
));
742 this_algorithm_base
->owned
= 0;
750 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
751 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
754 int vp8_ximagestart_decode
759 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
760 XIMAGE_INFO_PTR xinfo
= vpxdxv_get_ximage_info(src
);
765 ocf
.Width
= xinfo
->width
;
766 ocf
.Height
= xinfo
->height
;
769 if (this_algorithm_base
->common
== 0)
771 this_algorithm_base
->my_pbi
= (VP8D_COMP
*) vp8dx_create_decompressor(&ocf
);
772 this_algorithm_base
->owned
= 1;
773 this_algorithm_base
->common
= &this_algorithm_base
->my_pbi
->common
;
774 this_algorithm_base
->avgq
= 0;
778 this_algorithm_base
->passed_in_buffer
= 0;
779 this_algorithm_base
->post_proc2time
= 0;
780 this_algorithm_base
->post_proc4time
= 0;
781 this_algorithm_base
->ppcount
= 64;
786 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
787 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
790 DXV_HANDLE
vp8_ximagecreate(XIMAGE_HANDLE src
)
792 VP8_XIMAGE_HANDLE this_algorithm_base
;
794 /* create a new algorithm base container */
795 this_algorithm_base
= (VP8_XIMAGE_HANDLE
)duck_calloc(1, sizeof(VP8_XIMAGE
), DMEM_GENERAL
);
797 if (this_algorithm_base
== NULL
)
800 vp8_scale_machine_specific_config();
802 vpxdxv_register_ximage_start_decode(src
, vp8_ximagestart_decode
);
804 vpxdxv_register_ximage_stop_decode(src
, vp8_ximagestop_decode
);
806 vpxdxv_register_ximage_destroy(src
, vp8_ximagedestroy
);
808 vpxdxv_register_ximage_dx(src
, onyx_decompress
);
810 vpxdxv_register_ximage_set_parameter(src
, onyx_set_parameter
);
812 vpxdxv_register_ximage_output_format_func(src
,
813 onyx_get_output_format
,
814 onyx_set_output_format
);
816 vpxdxv_register_ximage_post_proc_level_func(src
,
820 return (DXV_HANDLE
)this_algorithm_base
;
824 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
825 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
828 static int store_output_list(unsigned int supported
, int count
,
829 unsigned int *outlist
)
836 while (supported
&& !(supported
& 0x01))
842 *(outlist
+ i
) = g_vp8_preferred_output_format_list
[j
];
853 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
854 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
856 static int onyx_get_output_list(XIMAGE_INFO_PTR xinfo
, unsigned int *outlist
,
860 ret
= DXV_INVALID_REQUEST
;
861 unsigned int supported
= 0,
867 for (i
= 0; i
< sizeof(g_vp8_preferred_output_format_list
) / sizeof(unsigned int) && i
< 32; ++i
)
869 if (vpx_get_blitter(g_vp8_preferred_output_format_list
[i
]) != (void *)0xffffffff)
871 supported
|= (1 << i
);
878 if (count
&& ((count
+ 1) == (*size
/ sizeof(int))))
879 ret
= store_output_list(supported
, count
, outlist
);
885 *size
= (count
+ 1) * sizeof(int);
894 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
895 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
901 /* register VPX blitters based on cpu */
904 vp8_rv
= vpxdxv_register_ximage(vp8_ximagecreate
, onyx_get_output_list
, VP8_FOURCC
);
910 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
911 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
916 vpxdxv_un_register_ximage(VP8_FOURCC
);
920 /****************************************************************************
922 * ROUTINE : onyx_set_parameter
924 * INPUTS : XIMAGE_HANDLE src :
926 * unsigned long Parameter :
935 * SPECIAL NOTES : None.
937 ****************************************************************************/
938 void onyx_set_parameter(XIMAGE_HANDLE src
, int Command
, unsigned int Parameter
)
940 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
944 case PBC_SET_CPUFREE
:
945 this_algorithm_base
->cpu_free
= Parameter
;
947 case PBC_SET_POSTPROC
:
948 this_algorithm_base
->postproc
= Parameter
;
951 case PBC_SET_BLITBUFF
:
952 this_algorithm_base
->passed_in_buffer
= (YV12_BUFFER_CONFIG
*) Parameter
;
955 case PBC_SET_REFERENCEFRAME
:
957 VP8_XIMAGE_HANDLE tab
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
960 vp8_yv12_copy_frame((YV12_BUFFER_CONFIG
*) Parameter
, &pbi
->common
.last_frame
);
968 this_algorithm_base
->common
= (VP8_COMMON
*)Parameter
;
972 case PBC_SET_ADDNOISE
:
973 this_algorithm_base
->add_noise
= Parameter
;
975 case PBC_SET_DEINTERLACEMODE
:
976 this_algorithm_base
->deinterlace
= Parameter
;
982 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
983 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
986 onyx_get_output_format(XIMAGE_HANDLE src
, unsigned int *format_tag
)
988 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
990 if (this_algorithm_base
)
992 *format_tag
= this_algorithm_base
->bd_tag
;
996 return DXV_NULL_BASE
;
1000 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1001 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1004 onyx_set_output_format(XIMAGE_HANDLE src
, unsigned int bd_tag
)
1006 VP8_XIMAGE_HANDLE this_algorithm_base
= (VP8_XIMAGE_HANDLE
)vpxdxv_get_algorithm_base_ptr(src
);
1008 unsigned int bd_tag_found
;
1010 if (this_algorithm_base
)
1015 while (g_vp8_preferred_output_format_list
[i
] != 0)
1017 if (g_vp8_preferred_output_format_list
[i
] == bd_tag
)
1028 this_algorithm_base
->blitter
= (vp8blit_func
)vpx_get_blitter(bd_tag
);
1029 this_algorithm_base
->bd_tag
= bd_tag
;
1033 return DXV_INVALID_BLIT
;
1036 return DXV_NULL_BASE
;
1040 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1041 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1044 vpx_get_size_of_pixel(unsigned int bd
)
1055 #ifdef _ENABLE_SPLIT_PIXEL_
1056 case VPXDXV_SPLIT565
:
1070 case VPXDXV_RGB8888
: