bfg-common 1.1.21 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/assets/localization/local_be.json +12 -1
  2. package/assets/localization/local_en.json +12 -1
  3. package/assets/localization/local_hy.json +12 -1
  4. package/assets/localization/local_kk.json +12 -1
  5. package/assets/localization/local_ru.json +12 -1
  6. package/assets/localization/local_zh.json +12 -1
  7. package/components/atoms/DiagramIcon.vue +53 -6
  8. package/components/atoms/TheIcon2.vue +14 -27
  9. package/components/atoms/alert/Notification.vue +167 -167
  10. package/components/atoms/autocomplete/Autocomplete.vue +236 -236
  11. package/components/atoms/datepicker/Datepicker.vue +612 -612
  12. package/components/atoms/list/SelectList.vue +62 -62
  13. package/components/atoms/nav/NavBar.vue +116 -116
  14. package/components/atoms/nav/VerticalNavBar.vue +89 -89
  15. package/components/atoms/notificationBar/NotificationBar.vue +174 -174
  16. package/components/atoms/perPage/PerPage.vue +52 -52
  17. package/components/atoms/popup/SimplePopup.vue +90 -90
  18. package/components/atoms/step/VerticalStep.vue +104 -104
  19. package/components/atoms/switch/Switch.vue +107 -107
  20. package/components/atoms/table/dataGrid/DataGrid.vue +2 -3
  21. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +204 -204
  22. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
  23. package/components/atoms/tabs/Tabs.vue +189 -189
  24. package/components/atoms/tooltip/Signpost.vue +224 -224
  25. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  26. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  27. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  28. package/components/common/browse/Browse.vue +182 -182
  29. package/components/common/browse/blocks/Title.vue +66 -66
  30. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
  31. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
  32. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  33. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  34. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  35. package/components/common/diagramMain/modals/viewSettings/ViewSettings.vue +1 -1
  36. package/components/common/diagramMain/network/Contents.vue +238 -238
  37. package/components/common/feedback/Buttons.vue +232 -232
  38. package/components/common/feedback/Message.vue +468 -468
  39. package/components/common/feedback/VisitPortal.vue +54 -54
  40. package/components/common/help/navbar/left/Left.vue +139 -139
  41. package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
  42. package/components/common/help/navbar/right/Right.vue +4 -4
  43. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +359 -359
  44. package/components/common/modals/Rename.vue +165 -165
  45. package/components/common/perPage/PerPage.vue +51 -51
  46. package/components/common/recursionTree/RecursionTree.vue +201 -201
  47. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -452
  48. package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
  49. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -373
  50. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  51. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  52. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  53. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  54. package/models/store/interfaces.ts +37 -37
  55. package/models/store/storage/interfaces.ts +32 -32
  56. package/models/store/types.ts +32 -32
  57. package/modules/fixContentBuild/index.ts +80 -80
  58. package/modules/fixContentBuild/utils/methods.ts +114 -114
  59. package/package.json +1 -1
  60. package/public/spice-console/application/codec.js +257 -257
  61. package/public/spice-console/lib/rasterEngine.js +907 -907
  62. package/public/spice-console/network/spicechannel.js +369 -369
  63. package/public/spice-console-minify/lib/decoder/dixie.min.js +4 -4
  64. package/public/spice-console-minify/lib/jgestures.min.js +24 -24
  65. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +24 -24
  66. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +11 -11
  67. package/public/spice-console-minify/lib/jquery-visibility.min.js +1 -1
  68. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +5 -5
  69. package/utils/contentBuild.ts +34 -34
@@ -1,5 +1,5 @@
1
- "use strict";function strcmp(_,e){return _==e?0:_>e?1:-1}var ptr=0,EXIT_SUCCESS=0,EXIT_FAILURE=1,SEEK_CUR=1,SEEK_END=2,SEEK_SET=0,buffer8k=function(){return Arr(8800,0)};function fread(_,e,r,t){if(_.val=new buffer8k,t.data.length<r+t.data_off)return t.data_off+=r,0;for(var n=0;n<r;++n)_.val[n]=t.data[t.data_off++];return _.val.length=r,n}function ftell(_){return _.data_off}function feof(_){return _.data.length<_.data_off?1:0}var char_=0,short_=0,int_=0,long_=0,void_=0,int8_t=char_,uint8_t=char_,int16_t=short_,uint16_t=short_,int32_t=int_,uint32_t=int_,uint64_t=long_,int64_t=long_,float_=0,size_t=0,double_=0,score_t=int64_t,CHAR_BIT=8,ptrdiff_t=int_,UINT8=char_,INT16=short_;function newObjectIt(_){return void 0===_?"error":JSON.parse(JSON.stringify(_))}function memcpy(_,e,r,t,n){var i;for(i=0;i<n;++i)_[e+i]=r[t+i];return _}function memset(_,e,r,t){var n=0;for(n=0;n<t;++n)_[e+n]=r}function malloc(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function assert(_){if(!_)throw new Error("assert :P")}function setjmp(_){return 0}function offsetof(_,e){return e}function Arr(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function Arr_new(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(new e);return t}function Arr_nOI(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(newObjectIt(e));return t}function ArrM(_,e){var r;new Array;for(r=_.length-1;r>=0;--r)e=newObjectIt(Arr(_[r],e));return e}function create_obj_vals_from_arrayChilds(_,e){var r;for(r=0;r<e.length;++r)e[r]=create_obj_vals_from_array(new _,e[r]);return e}function create_obj_vals_from_array(_,e){var r=_,t=0;for(var n in r)"object"==typeof r[n]&&Object.keys(r[n]).length==e[t].length?r[n]=create_obj_vals_from_array(r[n],e[t]):r[n]=e[t],t++;return r}var DC_PRED=0,V_PRED=1,H_PRED=2,TM_PRED=3,B_PRED=4,NEARESTMV=5,NEARMV=6,ZEROMV=7,NEWMV=8,SPLITMV=9,MB_MODE_COUNT=10,B_DC_PRED=0,B_TM_PRED=1,B_VE_PRED=2,B_HE_PRED=3,B_LD_PRED=4,B_RD_PRED=5,B_VR_PRED=6,B_VL_PRED=7,B_HD_PRED=8,B_HU_PRED=9,LEFT4X4=10,ABOVE4X4=11,ZERO4X4=12,NEW4X4=13,B_MODE_COUNT=14;function CODEC_INTERFACE(_,e){window[_+"_algo"]=create_obj_vals_from_array(vpx_codec_iface_t,e)}var VPX_CODEC_INTERNAL_ABI_VERSION=3,VPX_CODEC_CAP_DECODER=1,vpx_codec_ctrl_fn_map_t=function(){this.ctrl_id=int_,this.fn=0
2
- /*!\brief Decoder algorithm interface interface 285
3
- *
4
- * All decoders \ref MUST expose a variable of this type.
1
+ "use strict";function strcmp(_,e){return _==e?0:_>e?1:-1}var ptr=0,EXIT_SUCCESS=0,EXIT_FAILURE=1,SEEK_CUR=1,SEEK_END=2,SEEK_SET=0,buffer8k=function(){return Arr(8800,0)};function fread(_,e,r,t){if(_.val=new buffer8k,t.data.length<r+t.data_off)return t.data_off+=r,0;for(var n=0;n<r;++n)_.val[n]=t.data[t.data_off++];return _.val.length=r,n}function ftell(_){return _.data_off}function feof(_){return _.data.length<_.data_off?1:0}var char_=0,short_=0,int_=0,long_=0,void_=0,int8_t=char_,uint8_t=char_,int16_t=short_,uint16_t=short_,int32_t=int_,uint32_t=int_,uint64_t=long_,int64_t=long_,float_=0,size_t=0,double_=0,score_t=int64_t,CHAR_BIT=8,ptrdiff_t=int_,UINT8=char_,INT16=short_;function newObjectIt(_){return void 0===_?"error":JSON.parse(JSON.stringify(_))}function memcpy(_,e,r,t,n){var i;for(i=0;i<n;++i)_[e+i]=r[t+i];return _}function memset(_,e,r,t){var n=0;for(n=0;n<t;++n)_[e+n]=r}function malloc(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function assert(_){if(!_)throw new Error("assert :P")}function setjmp(_){return 0}function offsetof(_,e){return e}function Arr(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function Arr_new(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(new e);return t}function Arr_nOI(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(newObjectIt(e));return t}function ArrM(_,e){var r;new Array;for(r=_.length-1;r>=0;--r)e=newObjectIt(Arr(_[r],e));return e}function create_obj_vals_from_arrayChilds(_,e){var r;for(r=0;r<e.length;++r)e[r]=create_obj_vals_from_array(new _,e[r]);return e}function create_obj_vals_from_array(_,e){var r=_,t=0;for(var n in r)"object"==typeof r[n]&&Object.keys(r[n]).length==e[t].length?r[n]=create_obj_vals_from_array(r[n],e[t]):r[n]=e[t],t++;return r}var DC_PRED=0,V_PRED=1,H_PRED=2,TM_PRED=3,B_PRED=4,NEARESTMV=5,NEARMV=6,ZEROMV=7,NEWMV=8,SPLITMV=9,MB_MODE_COUNT=10,B_DC_PRED=0,B_TM_PRED=1,B_VE_PRED=2,B_HE_PRED=3,B_LD_PRED=4,B_RD_PRED=5,B_VR_PRED=6,B_VL_PRED=7,B_HD_PRED=8,B_HU_PRED=9,LEFT4X4=10,ABOVE4X4=11,ZERO4X4=12,NEW4X4=13,B_MODE_COUNT=14;function CODEC_INTERFACE(_,e){window[_+"_algo"]=create_obj_vals_from_array(vpx_codec_iface_t,e)}var VPX_CODEC_INTERNAL_ABI_VERSION=3,VPX_CODEC_CAP_DECODER=1,vpx_codec_ctrl_fn_map_t=function(){this.ctrl_id=int_,this.fn=0
2
+ /*!\brief Decoder algorithm interface interface 285
3
+ *
4
+ * All decoders \ref MUST expose a variable of this type.
5
5
  */},vpx_codec_iface=function(){this.name=char_,this.abi_version=int_,this.caps=long_,this.init="vpx_codec_init_fn_t",this.destroy="vpx_codec_destroy_fn_t",this.ctrl_maps=new vpx_codec_ctrl_fn_map_t,this.get_mmap="vpx_codec_get_mmap_fn_t",this.set_mmap="vpx_codec_set_mmap_fn_t",this.dec=new Object({peek_si:"vpx_codec_peek_si_fn_t",get_si:"vpx_codec_get_si_fn_t",decode:"vpx_codec_decode_fn_t",get_frame:"vpx_codec_get_frame_fn_t"})},vpx_codec_iface_t=vpx_codec_iface,VERSION_STRING=" v0.9.7",VPX_CODEC_OK=0,VPX_CODEC_MEM_ERROR=2,VPX_IMAGE_ABI_VERSION=1;VPX_IMG_FMT_I420=258,VPX_IMG_FMT_VPXI420=260;var VPX_PLANE_PACKED=0,VPX_PLANE_Y=0,VPX_PLANE_U=1,VPX_PLANE_V=2,VPX_PLANE_ALPHA=3,PLANE_PACKED=VPX_PLANE_PACKED,PLANE_Y=VPX_PLANE_Y,PLANE_U=VPX_PLANE_U,PLANE_V=VPX_PLANE_V,PLANE_ALPHA=VPX_PLANE_ALPHA,vpx_image_t=function(){this.fmt=0,this.w=this.w=int_,this.h=this.h=int_,this.d_w=this.d_w=int_,this.d_h=this.d_h=int_,this.x_chroma_shift=this.x_chroma_shift=int_,this.y_chroma_shift=this.y_chroma_shift=int_,this.planes=this.planes=new Array(4),this.planes_off=this.planes_off=new Array(4),this.stride=this.stride=new Array(4),this.bps=this.bps=int_,this.user_priv=this.user_priv=void_,this.img_data=this.img_data=char_,this.img_data_off=this.img_data_off=0,this.img_data_owner=this.img_data_owner=int_,this.self_allocd=this.self_allocd=int_},NESTEGG_TRACK_VIDEO=0,NESTEGG_TRACK_AUDIO=1,NESTEGG_CODEC_VP8=0,NESTEGG_CODEC_VORBIS=1,NESTEGG_SEEK_SET=0,NESTEGG_SEEK_CUR=1,NESTEGG_SEEK_END=2,NESTEGG_LOG_DEBUG=1,NESTEGG_LOG_INFO=10,NESTEGG_LOG_WARNING=100,NESTEGG_LOG_ERROR=1e3,NESTEGG_LOG_CRITICAL=1e4,nestegg_io=function(){this.read=int_,this.seek=int_,this.tell=int64_t,this.userdata=void_},nestegg_video_params=function(){this.width=int_,this.height=int_,this.display_width=int_,this.display_height=int_,this.crop_bottom=int_,this.crop_top=int_,this.crop_left=int_,this.crop_right=int_},ID_EBML=440786851,ID_EBML_VERSION=17030,ID_EBML_READ_VERSION=17143,ID_EBML_MAX_ID_LENGTH=17138,ID_EBML_MAX_SIZE_LENGTH=17139,ID_DOCTYPE=17026,ID_DOCTYPE_VERSION=17031,ID_DOCTYPE_READ_VERSION=17029,ID_VOID=236,ID_CRC32=191,ID_SEGMENT=408125543,ID_SEEK_HEAD=290298740,ID_SEEK=19899,ID_SEEK_ID=21419,ID_SEEK_POSITION=21420,ID_INFO=357149030,ID_TIMECODE_SCALE=2807729,ID_DURATION=17545,ID_CLUSTER=524531317,ID_TIMECODE=231,ID_BLOCK_GROUP=160,ID_SIMPLE_BLOCK=163,ID_BLOCK=161,ID_BLOCK_DURATION=155,ID_REFERENCE_BLOCK=251,ID_TRACKS=374648427,ID_TRACK_ENTRY=174,ID_TRACK_NUMBER=215,ID_TRACK_UID=29637,ID_TRACK_TYPE=131,ID_FLAG_ENABLED=185,ID_FLAG_DEFAULT=136,ID_FLAG_LACING=156,ID_TRACK_TIMECODE_SCALE=2306383,ID_LANGUAGE=2274716,ID_CODEC_ID=134,ID_CODEC_PRIVATE=25506,ID_VIDEO=224,ID_PIXEL_WIDTH=176,ID_PIXEL_HEIGHT=186,ID_PIXEL_CROP_BOTTOM=21674,ID_PIXEL_CROP_TOP=21691,ID_PIXEL_CROP_LEFT=21708,ID_PIXEL_CROP_RIGHT=21725,ID_DISPLAY_WIDTH=21680,ID_DISPLAY_HEIGHT=21690,ID_AUDIO=225,ID_SAMPLING_FREQUENCY=181,ID_CHANNELS=159,ID_BIT_DEPTH=25188,ID_CUES=475249515,ID_CUE_POINT=187,ID_CUE_TIME=179,ID_CUE_TRACK_POSITIONS=183,ID_CUE_TRACK=247,ID_CUE_CLUSTER_POSITION=241,ID_CUE_BLOCK_NUMBER=21368,TYPE_UNKNOWN=0,TYPE_MASTER=1,TYPE_UINT=2,TYPE_FLOAT=3,TYPE_INT=4,TYPE_STRING=5,TYPE_BINARY=6,LIMIT_STRING=1<<20,LIMIT_BINARY=1<<24,LIMIT_BLOCK=1<<30,LIMIT_FRAME=1<<28,DESC_FLAG_NONE=0,DESC_FLAG_MULTI=1,DESC_FLAG_SUSPEND=2,DESC_FLAG_OFFSET=4,BLOCK_FLAGS_LACING=6,LACING_NONE=0,LACING_XIPH=1,LACING_FIXED=2,LACING_EBML=3,TRACK_TYPE_VIDEO=1,TRACK_TYPE_AUDIO=2,TRACK_ID_VP8="V_VP8",TRACK_ID_VORBIS="A_VORBIS",MASK_NONE=0,MASK_FIRST_BIT=1,ebml_binary=function(){this.data=char_,this.length=size_t},ebml_list_node=function(){this.next=null,this.id=uint64_t,this.data=void_},ebml_list=function(){this.head=null,this.tail=null},ebml_type=function(){this.v=new Object({u:uint64_t,f:double_,i:int64_t,s:char_,b:new ebml_binary}),this.type=0,this.read=int_},ebml=window.ebml=function(){this.ebml_version=this.ebml_version=new ebml_type,this.ebml_read_version=this.ebml_read_version=new ebml_type,this.ebml_max_id_length=this.ebml_max_id_length=new ebml_type,this.ebml_max_size_length=this.ebml_max_size_length=new ebml_type,this.doctype=this.doctype=new ebml_type,this.doctype_version=this.doctype_version=new ebml_type,this.doctype_read_version=this.doctype_read_version=new ebml_type},seek=window.seek=function(){this.id=this.id=new ebml_type,this.position=this.position=new ebml_type},seek_head=window.seek_head=function(){this.seek=this.seek=new ebml_list},info=window.info=function(){this.timecode_scale=this.timecode_scale=new ebml_type,this.duration=this.duration=new ebml_type},block_group=window.block_group=function(){this.duration=this.duration=new ebml_type,this.reference_block=this.reference_block=new ebml_type},cluster=window.cluster=function(){this.timecode=this.timecode=new ebml_type,this.block_group=this.block_group=new ebml_list},video=window.video=function(){this.pixel_width=this.pixel_width=new ebml_type,this.pixel_height=this.pixel_height=new ebml_type,this.pixel_crop_bottom=this.pixel_crop_bottom=new ebml_type,this.pixel_crop_top=this.pixel_crop_top=new ebml_type,this.pixel_crop_left=this.pixel_crop_left=new ebml_type,this.pixel_crop_right=this.pixel_crop_right=new ebml_type,this.display_width=this.display_width=new ebml_type,this.display_height=this.display_height=new ebml_type},audio=window.audio=function(){this.sampling_frequency=this.sampling_frequency=new ebml_type,this.channels=this.channels=new ebml_type,this.bit_depth=this.bit_depth=new ebml_type},track_entry=window.track_entry=function(){this.number=this.number=new ebml_type,this.uid=this.uid=new ebml_type,this.type=this.type=new ebml_type,this.flag_enabled=this.flag_enabled=new ebml_type,this.flag_default=this.flag_default=new ebml_type,this.flag_lacing=this.flag_lacing=new ebml_type,this.track_timecode_scale=this.track_timecode_scale=new ebml_type,this.language=this.language=new ebml_type,this.codec_id=this.codec_id=new ebml_type,this.codec_private=this.codec_private=new ebml_type,this.video=this.video=new video,this.audio=this.audio=new audio},tracks=window.tracks=function(){this.track_entry=this.track_entry=new ebml_list},cue_track_positions=window.cue_track_positions=function(){this.track=this.track=new ebml_type,this.cluster_position=this.cluster_position=new ebml_type,this.block_number=this.block_number=new ebml_type},cue_point=window.cue_point=function(){this.time=this.time=new ebml_type,this.cue_track_positions=this.cue_track_positions=new ebml_list},cues=window.cues=function(){this.cue_point=this.cue_point=new ebml_list},segment=window.segment=function(){this.seek_head=this.seek_head=new ebml_list,this.info=this.info=new info,this.cluster=this.cluster=new ebml_list,this.tracks=this.tracks=new tracks,this.cues=this.cues=new cues},pool_ctx=function(){this.dummy=char_},list_node=function(){this.previous=0,this.node=new ebml_element_desc,this.data=char_},frame=function(){this.data=char_,this.length=size_t,this.next=null},nestegg=function(){this.io=new nestegg_io,this.log_=0,this.alloc_pool=new pool_ctx,this.last_id=uint64_t,this.last_size=uint64_t,this.ancestor=null,this.ebml=this.ebml=new ebml,this.segment=this.segment=new segment,this.segment_offset=int64_t,this.track_count=int_},nestegg_packet=function(){this.track=uint64_t,this.timecode=uint64_t,this.frame=new frame},ebml_element_desc=function(){this.name=char_,this.id=uint64_t,this.type=0,this.offset=size_t,this.flags=int_,this.children=null,this.size=size_t,this.data_offset=size_t};function E_FIELD(_,e,r,t,n){return new Array(_,e,r,n,DESC_FLAG_NONE,null,0,0)}function E_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_MULTI,i,1,0)}function E_SINGLE_MASTER_O(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_OFFSET,i,0,n+"_offset")}function E_SINGLE_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_NONE,i,0,0)}function E_SUSPEND(_,e,r){return new Array(_,e,r,0,DESC_FLAG_SUSPEND,null,0,0)}var E_LAST=new Array(null,0,0,0,DESC_FLAG_NONE,null,0,0),ne_ebml_elements=create_ebml_element_desc(new Array(E_FIELD("ID_EBML_VERSION",ID_EBML_VERSION,TYPE_UINT,"ebml","ebml_version"),E_FIELD("ID_EBML_READ_VERSION",ID_EBML_READ_VERSION,TYPE_UINT,"ebml","ebml_read_version"),E_FIELD("ID_EBML_MAX_ID_LENGTH",ID_EBML_MAX_ID_LENGTH,TYPE_UINT,"ebml","ebml_max_id_length"),E_FIELD("ID_EBML_MAX_SIZE_LENGTH",ID_EBML_MAX_SIZE_LENGTH,TYPE_UINT,"ebml","ebml_max_size_length"),E_FIELD("ID_DOCTYPE",ID_DOCTYPE,TYPE_STRING,"ebml","doctype"),E_FIELD("ID_DOCTYPE_VERSION",ID_DOCTYPE_VERSION,TYPE_UINT,"ebml","doctype_version"),E_FIELD("ID_DOCTYPE_READ_VERSION",ID_DOCTYPE_READ_VERSION,TYPE_UINT,"ebml","doctype_read_version"),E_LAST)),ne_seek_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SEEK_ID",ID_SEEK_ID,TYPE_BINARY,"seek","id"),E_FIELD("ID_SEEK_POSITION",ID_SEEK_POSITION,TYPE_UINT,"seek","position"),E_LAST)),ne_seek_head_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK",ID_SEEK,TYPE_MASTER,"seek_head","seek",ne_seek_elements),E_LAST)),ne_info_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE_SCALE",ID_TIMECODE_SCALE,TYPE_UINT,"info","timecode_scale"),E_FIELD("ID_DURATION",ID_DURATION,TYPE_FLOAT,"info","duration"),E_LAST)),ne_block_group_elements=create_ebml_element_desc(new Array(E_SUSPEND("ID_BLOCK",ID_BLOCK,TYPE_BINARY),E_FIELD("ID_BLOCK_DURATION",ID_BLOCK_DURATION,TYPE_UINT,"block_group","duration"),E_FIELD("ID_REFERENCE_BLOCK",ID_REFERENCE_BLOCK,TYPE_INT,"block_group","reference_block"),E_LAST)),ne_cluster_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE",ID_TIMECODE,TYPE_UINT,"cluster","timecode"),E_MASTER("ID_BLOCK_GROUP",ID_BLOCK_GROUP,TYPE_MASTER,"cluster","block_group",ne_block_group_elements),E_SUSPEND("ID_SIMPLE_BLOCK",ID_SIMPLE_BLOCK,TYPE_BINARY),E_LAST)),ne_video_elements=create_ebml_element_desc(new Array(E_FIELD("ID_PIXEL_WIDTH",ID_PIXEL_WIDTH,TYPE_UINT,"video","pixel_width"),E_FIELD("ID_PIXEL_HEIGHT",ID_PIXEL_HEIGHT,TYPE_UINT,"video","pixel_height"),E_FIELD("ID_PIXEL_CROP_BOTTOM",ID_PIXEL_CROP_BOTTOM,TYPE_UINT,"video","pixel_crop_bottom"),E_FIELD("ID_PIXEL_CROP_TOP",ID_PIXEL_CROP_TOP,TYPE_UINT,"video","pixel_crop_top"),E_FIELD("ID_PIXEL_CROP_LEFT",ID_PIXEL_CROP_LEFT,TYPE_UINT,"video","pixel_crop_left"),E_FIELD("ID_PIXEL_CROP_RIGHT",ID_PIXEL_CROP_RIGHT,TYPE_UINT,"video","pixel_crop_right"),E_FIELD("ID_DISPLAY_WIDTH",ID_DISPLAY_WIDTH,TYPE_UINT,"video","display_width"),E_FIELD("ID_DISPLAY_HEIGHT",ID_DISPLAY_HEIGHT,TYPE_UINT,"video","display_height"),E_LAST)),ne_audio_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SAMPLING_FREQUENCY",ID_SAMPLING_FREQUENCY,TYPE_FLOAT,"audio","sampling_frequency"),E_FIELD("ID_CHANNELS",ID_CHANNELS,TYPE_UINT,"audio","channels"),E_FIELD("ID_BIT_DEPTH",ID_BIT_DEPTH,TYPE_UINT,"audio","bit_depth"),E_LAST)),ne_track_entry_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TRACK_NUMBER",ID_TRACK_NUMBER,TYPE_UINT,"track_entry","number"),E_FIELD("ID_TRACK_UID",ID_TRACK_UID,TYPE_UINT,"track_entry","uid"),E_FIELD("ID_TRACK_TYPE",ID_TRACK_TYPE,TYPE_UINT,"track_entry","type"),E_FIELD("ID_FLAG_ENABLED",ID_FLAG_ENABLED,TYPE_UINT,"track_entry","flag_enabled"),E_FIELD("ID_FLAG_DEFAULT",ID_FLAG_DEFAULT,TYPE_UINT,"track_entry","flag_default"),E_FIELD("ID_FLAG_LACING",ID_FLAG_LACING,TYPE_UINT,"track_entry","flag_lacing"),E_FIELD("ID_TRACK_TIMECODE_SCALE",ID_TRACK_TIMECODE_SCALE,TYPE_FLOAT,"track_entry","track_timecode_scale"),E_FIELD("ID_LANGUAGE",ID_LANGUAGE,TYPE_STRING,"track_entry","language"),E_FIELD("ID_CODEC_ID",ID_CODEC_ID,TYPE_STRING,"track_entry","codec_id"),E_FIELD("ID_CODEC_PRIVATE",ID_CODEC_PRIVATE,TYPE_BINARY,"track_entry","codec_private"),E_SINGLE_MASTER("ID_VIDEO",ID_VIDEO,TYPE_MASTER,"track_entry","video",ne_video_elements),E_SINGLE_MASTER("ID_AUDIO",ID_AUDIO,TYPE_MASTER,"track_entry","audio",ne_audio_elements),E_LAST)),ne_tracks_elements=create_ebml_element_desc(new Array(E_MASTER("ID_TRACK_ENTRY",ID_TRACK_ENTRY,TYPE_MASTER,"tracks","track_entry",ne_track_entry_elements),E_LAST)),ne_cue_track_positions_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TRACK",ID_CUE_TRACK,TYPE_UINT,"cue_track_positions","track"),E_FIELD("ID_CUE_CLUSTER_POSITION",ID_CUE_CLUSTER_POSITION,TYPE_UINT,"cue_track_positions","cluster_position"),E_FIELD("ID_CUE_BLOCK_NUMBER",ID_CUE_BLOCK_NUMBER,TYPE_UINT,"cue_track_positions","block_number"),E_LAST)),ne_cue_point_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TIME",ID_CUE_TIME,TYPE_UINT,"cue_point","time"),E_MASTER("ID_CUE_TRACK_POSITIONS",ID_CUE_TRACK_POSITIONS,TYPE_MASTER,"cue_point","cue_track_positions",ne_cue_track_positions_elements),E_LAST)),ne_cues_elements=create_ebml_element_desc(new Array(E_MASTER("ID_CUE_POINT",ID_CUE_POINT,TYPE_MASTER,"cues","cue_point",ne_cue_point_elements),E_LAST)),ne_segment_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK_HEAD",ID_SEEK_HEAD,TYPE_MASTER,"segment","seek_head",ne_seek_head_elements),E_SINGLE_MASTER("ID_INFO",ID_INFO,TYPE_MASTER,"segment","info",ne_info_elements),E_MASTER("ID_CLUSTER",ID_CLUSTER,TYPE_MASTER,"segment","cluster",ne_cluster_elements),E_SINGLE_MASTER("ID_TRACKS",ID_TRACKS,TYPE_MASTER,"segment","tracks",ne_tracks_elements),E_SINGLE_MASTER("ID_CUES",ID_CUES,TYPE_MASTER,"segment","cues",ne_cues_elements),E_LAST)),ne_top_level_elements=create_ebml_element_desc(new Array(E_SINGLE_MASTER("ID_EBML",ID_EBML,TYPE_MASTER,"nestegg","ebml",ne_ebml_elements),E_SINGLE_MASTER_O("ID_SEGMENT",ID_SEGMENT,TYPE_MASTER,"nestegg","segment",ne_segment_elements),E_LAST));function create_ebml_element_desc(_){for(var e=new Array,r=0;r<_.length;++r){var t=0,n=new ebml_element_desc;for(var i in n)"undefined"!==_[r][t]&&(n[i]=_[r][t++]);e.push(n)}return e}function ne_pool_init(_){return new pool_ctx}var buffer_8192=Arr(8192,0);function ne_io_read_skip(_,e){for(var r=size_t,t={val:buffer_8192},n=1;e>0&&1==(n=ne_io_read(_,t,r=e<t.val.length?e:t.val.length));)e-=r;return n}function ne_io_tell(_){return _.tell(_.userdata)}function ne_bare_read_vint(_,e,r,t){var n=int_,i={val:char_},a=1,o=128;if(1!=(n=ne_io_read(_,i,1)))return n;for(;a<8&&0==(i.val[0]&o);)o>>=1,a+=1;for(r&&(r.val=a),e.val=i.val[0],t==MASK_FIRST_BIT&&(e.val=i.val[0]&~o);--a;){if(1!=(n=ne_io_read(_,i,1)))return n;e.val<<=8,e.val|=i.val[0]}return 1}function ne_io_read(_,e,r){return _.read(e,r,_.userdata)}function ne_read_id(_,e,r){return ne_bare_read_vint(_,e,r,MASK_NONE)}function ne_read_vint(_,e,r){return ne_bare_read_vint(_,e,r,MASK_FIRST_BIT)}function ne_read_svint(_,e,r){var t=int_,n=[uint64_t],i=[uint64_t],a=new Array(63,8191,1048575,134217727,17179869183,2199023255551,0xffffffffffff,0x80000000000000);return 1!=(t=ne_bare_read_vint(_,n,i,MASK_FIRST_BIT))||(e[0]=n-a[i-1],r&&(r[0]=i)),t}function ne_read_uint(_,e,r){var t={val:char_},n=int_;if(0==r||r>8)return-1;if(1!=(n=ne_io_read(_,t,1)))return n;for(e[0]=t.val[0];--r;){if(1!=(n=ne_io_read(_,t,1)))return n;e[0]<<=8,e[0]|=t.val[0]}return 1}function ne_read_int(_,e,r){var t,n=[uint64_t],i=uint64_t;return 1!=(t=ne_read_uint(_,n,r))?t:(r<8?(i=1,n>=(i<<=8*r-1)?(i=1,i<<=8*r):i=0,e[0]=n-i):e[0]=n,1)}function ne_read_float(_,e,r){var t,n={u:[uint64_t],f:[float_],d:[double_]};return 4!=r&&8!=r?-1:1!=(t=ne_read_uint(_,n.u,r))?t:(e[0]=4==r?n.f=n.u:n.d=n.u,1)}function ne_read_string(_,e,r){var t,n={val:char_};if(0==r||r>LIMIT_STRING)return-1;if(1!=(t=ne_io_read(_.io,n,r)))return t;for(var i="",a=0;a<r;++a)i+=String.fromCharCode(n.val[a]);return n.val=i,e[0]=n.val,1}function ne_read_binary(_,e,r){return 0==r||r>LIMIT_BINARY?-1:(e.data={val:0},e.length=r,ne_io_read(_.io,e.data,r))}function ne_get_uint(_,e){return _.read?(assert(_.type==TYPE_UINT),e[0]=_.v.u,0):-1}function ne_get_string(_,e){return _.read?(assert(_.type==TYPE_STRING),e[0]=_.v.s,0):-1}function ne_is_ancestor_element(_,e){for(;e;e=e.previous)for(var r=e.node,t=0;r[t].id;++t)if(r[t].id==_)return 1;return 0}function ne_find_element(_,e){for(var r=e,t=0;r[t].id;++t)if(r[t].id==_)return r[t];return null}function ne_ctx_push(_,e,r){var t=new list_node;t.previous=_.ancestor,t.node=e,t.data=r,_.ancestor=t}function ne_ctx_pop(_){var e;e=_.ancestor,_.ancestor=e.previous,e=""}function ne_peek_element(_,e,r){var t=int_;return _.last_id&&_.last_size?(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1):(_.last_id={val:_.last_id},t=ne_read_id(_.io,_.last_id,null),_.last_id=_.last_id.val,1!=t?t:(_.last_size={val:_.last_size},t=ne_read_vint(_.io,_.last_size,null),_.last_size=_.last_size.val,1!=t?t:(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1)))}function ne_read_element(_,e,r){var t;return 1!=(t=ne_peek_element(_,e,r))?t:(_.last_id=0,_.last_size=0,1)}function ne_read_master(_,e){var r,t,n=new ebml_list_node;assert(e.type==TYPE_MASTER&&e.flags&DESC_FLAG_MULTI),_.ancestor.data[e.offset]&&(r=_.ancestor.data[e.offset]),n.id=e.id,n.data=new window[e.offset],(t=r.tail)&&(t.next=n),r.tail=n,r.head||(r.head=n),ne_ctx_push(_,e.children,n.data)}function ne_read_single_master(_,e){assert(e.type==TYPE_MASTER&&!(e.flags&DESC_FLAG_MULTI)),ne_ctx_push(_,e.children,_.ancestor.data[e.offset])}function ne_read_simple(_,e,r){var t,n=int_;if(_.ancestor.data[e.offset]&&(t=_.ancestor.data[e.offset]),t.read)return 0;switch(t.type=e.type,n=-1,e.type){case TYPE_UINT:t.v.u=[t.v.u],n=ne_read_uint(_.io,t.v.u,r),t.v.u=t.v.u[0];break;case TYPE_FLOAT:t.v.f=[t.v.f],n=ne_read_float(_.io,t.v.f,r),t.v.f=t.v.f[0];break;case TYPE_INT:t.v.i=[t.v.i],n=ne_read_int(_.io,t.v.i,r),t.v.i=t.v.i[0];break;case TYPE_STRING:t.v.s=[t.v.s],n=ne_read_string(_,t.v.s,r),t.v.s=t.v.s[0];break;case TYPE_BINARY:n=ne_read_binary(_,t.v.b,r);break;case TYPE_MASTER:case TYPE_UNKNOWN:assert(0)}return 1==n&&(t.read=1),n}function ne_parse(_,e){var r,t=int_,n=int64_t,i=[uint64_t],a=[uint64_t];if(!_.ancestor)return-1;for(;1==(t=ne_peek_element(_,i,a));)if(r=ne_find_element(i[0],_.ancestor.node)){if(r.flags&DESC_FLAG_SUSPEND){assert(r.type==TYPE_BINARY),t=1;break}if(1!=(t=ne_read_element(_,i,a)))break;if(r.flags&DESC_FLAG_OFFSET&&((n=_.ancestor.data[r.data_offset]={v:null}).v=ne_io_tell(_.io),n<0)){t=-1;break}if(r.type==TYPE_MASTER){r.flags&DESC_FLAG_MULTI?ne_read_master(_,r):ne_read_single_master(_,r);continue}if((t=ne_read_simple(_,r,a[0]))<0)break}else if(ne_is_ancestor_element(i,_.ancestor.previous)){if(e&&_.ancestor.node==e){t=1;break}ne_ctx_pop(_)}else{if(1!=(t=ne_read_element(_,i,a)))break;if(1!=(t=ne_io_read_skip(_.io,a[0])))break}if(1!=t)for(;_.ancestor;)ne_ctx_pop(_);return t}function ne_read_xiph_lace_value(_,e,r,t){var n=int_,i=[uint64_t];if(1!=(n=ne_read_uint(_,i,1)))return n;for(t[0]+=1,e[r+0]=i[0];255==i[0];){if(1!=(n=ne_read_uint(_,i,1)))return n;t[0]+=1,e[r+0]+=i[0]}return 1}function ne_read_xiph_lacing(_,e,r,t,n){for(var i=int_,a=0,o=0;--t;){if(1!=(i=ne_read_xiph_lace_value(_,n,a,r)))return i;o+=n[a],a+=1}return r[0]+o>e?-1:(n[a]=e-r[0]-o,1)}function ne_read_ebml_lacing(_,e,r,t,n){var i=int_,a=[uint64_t],o=uint64_t,s=[uint64_t],f=[int64_t],d=0;if(1!=(i=ne_read_vint(_,a,s)))return i;for(r[0]+=s[0],n[d]=a[0],o=n[d],d+=1,t-=1;--t;){if(1!=(i=ne_read_svint(_,f,s)))return i;r[0]+=s[0],n[d]=n[d-1]+f[0],o+=n[d],d+=1}return r[0]+o>e?-1:(n[d]=e-r[0]-o,1)}function ne_get_timecode_scale(_){var e=[uint64_t];return 0!=ne_get_uint(_.segment.info.timecode_scale,e)&&(e[0]=1e6),e[0]}function ne_find_track_entry(_,e){for(var r=0,t=_.segment.tracks.track_entry.head;t;){if(assert(t.id==ID_TRACK_ENTRY),e==r)return t.data;r+=1,t=t.next}return null}var frame_sizes_256=Arr(256,0);function ne_read_block(_,e,r,t){var n,i,a,o,s,f,d=int_,E=[int64_t],c={val:uint64_t},l={val:uint64_t},m=frame_sizes_256,A=[uint64_t],u=[uint64_t],p=[uint64_t],T=uint64_t,y=int_,b=[0];if(t[0]=null,r>LIMIT_BLOCK)return-1;if(1!=(d=ne_read_vint(_.io,c,l)))return d;if(0==c.val||c.val>_.track_count)return-1;if(b[0]+=l.val,1!=(d=ne_read_int(_.io,E,2)))return d;if(b[0]+=2,1!=(d=ne_read_uint(_.io,u,1)))return d;switch(b[0]+=1,p[0]=0,f=(u[0]&BLOCK_FLAGS_LACING)>>1){case LACING_NONE:p[0]=1;break;case LACING_XIPH:case LACING_FIXED:case LACING_EBML:if(1!=(d=ne_read_uint(_.io,p,1)))return d;b[0]+=1,p[0]+=1}if(p[0]>256)return-1;switch(f){case LACING_NONE:m[0]=r-b[0];break;case LACING_XIPH:if(1==p)return-1;if(1!=(d=ne_read_xiph_lacing(_.io,r,b,p,m)))return d;break;case LACING_FIXED:if((r-b[0])%p[0])return-1;for(y=0;y<p[0];++y)m[y]=(r-b[0])/p>>0;break;case LACING_EBML:if(1==p[0])return-1;if(1!=(d=ne_read_ebml_lacing(_.io,r,b,p,m)))return d}for(T=b[0],y=0;y<p[0];++y)T+=m[y];if(T>r)return-1;if(!ne_find_track_entry(_,c.val-1))return-1;if(1,s=ne_get_timecode_scale(_),assert(_.segment.cluster.tail.id==ID_CLUSTER),0!=ne_get_uint(_.segment.cluster.tail.data.timecode,A))return-1;if((n=E[0]+A[0])<0)return-1;for((i=new nestegg_packet).track=c.val-1,i.timecode=n*s*1,o=null,y=0;y<p[0];++y){if(m[y]>LIMIT_FRAME)return nestegg_free_packet(i),-1;if((a=new frame).data=[],a.length=m[y],a.data={val:a.data},d=ne_io_read(_.io,a.data,m[y]),a.data=a.data.val,1!=d)return a.data=null,a=null,nestegg_free_packet(i),-1;o?o.next=a:i.frame=a,o=a}return t[0]=i,1}function ne_null_log_callback(_,e,r,t){}function ne_is_suspend_element(_){return _==ID_SIMPLE_BLOCK||_==ID_BLOCK?1:0}var ctx_=new nestegg;function nestegg_init(_,e,r){var t,n=[0],i=[0],a=[uint64_t],o=[char_],s=ctx_;if(!(e.read&&e.seek&&e.tell))return-1;if(s.io=e,s.alloc_pool=ne_pool_init(),1!=ne_peek_element(s,n,null))return nestegg_destroy(s),-1;if(n[0]!=ID_EBML)return nestegg_destroy(s),-1;if(ne_ctx_push(s,ne_top_level_elements,s),1!=ne_parse(s,null))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.ebml_read_version,i)&&(i=1),1!=i[0])return nestegg_destroy(s),-1;if(0!=ne_get_string(s.ebml.doctype,o)&&(o[0]="matroska"),0!=strcmp(o[0],"webm"))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.doctype_read_version,a)&&(a[0]=1),a[0]<1||a[0]>2)return nestegg_destroy(s),-1;if(!s.segment.tracks.track_entry.head)return nestegg_destroy(s),-1;for(t=s.segment.tracks.track_entry.head,s.track_count=0;t;)s.track_count+=1,t=t.next;return _[0]=s,0}function nestegg_destroy(_){}function nestegg_track_count(_,e){return e[0]=_.track_count,0}function nestegg_track_type(_,e){var r=[uint64_t],t=ne_find_track_entry(_,e);return t?0!=ne_get_uint(t.type,r)?-1:r[0]&TRACK_TYPE_VIDEO?NESTEGG_TRACK_VIDEO:r[0]&TRACK_TYPE_AUDIO?NESTEGG_TRACK_AUDIO:-1:-1}function nestegg_track_codec_id(_,e){var r=[char_],t=ne_find_track_entry(_,e);return t?0!=ne_get_string(t.codec_id,r)?-1:0==strcmp(r[0],TRACK_ID_VP8)?NESTEGG_CODEC_VP8:0==strcmp(r[0],TRACK_ID_VORBIS)?NESTEGG_CODEC_VORBIS:-1:-1}function nestegg_track_video_params(_,e,r){var t=[uint64_t],n=ne_find_track_entry(_,e);return n?nestegg_track_type(_,e)!=NESTEGG_TRACK_VIDEO||0!=ne_get_uint(n.video.pixel_width,t)?-1:(r.width=t[0],0!=ne_get_uint(n.video.pixel_height,t)?-1:(r.height=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_bottom,t),r.crop_bottom=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_top,t),r.crop_top=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_left,t),r.crop_left=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_right,t),r.crop_right=t[0],t[0]=r.width,ne_get_uint(n.video.display_width,t),r.display_width=t[0],t[0]=r.height,ne_get_uint(n.video.display_height,t),r.display_height=t[0],0)):-1}function nestegg_read_packet(_,e){var r=int_,t=[uint64_t],n=[uint64_t];for(e[0]=null;;){if(1!=(r=ne_peek_element(_,t,n)))return r;if(ne_is_suspend_element(t))return 1!=(r=ne_read_element(_,t,n))?r:r=ne_read_block(_,t,n[0],e);if(1!=(r=ne_parse(_,null)))return r}return 1}function nestegg_free_packet(_){for(var e;_.frame;)e=_.frame,_.frame=e.next,e.data="",e="";_=""}function nestegg_packet_track(_,e){return e[0]=_[0].track,0}function nestegg_packet_count(_,e){var r=_[0].frame;for(e[0]=0;r;)e[0]+=1,r=r.next;return 0}function nestegg_packet_data(_,e,r,t){var n=_[0].frame,i=0;for(r[0]=null,t[0]=0;n;){if(i==e)return r[0]=n.data,t[0]=n.length,0;i+=1,n=n.next}return-1}VPX_IMAGE_ABI_VERSION=1;var VPX_IMG_FMT_PLANAR=256,VPX_IMG_FMT_UV_FLIP=512,VPX_IMG_FMT_HAS_ALPHA=1024,VPX_IMG_FMT_NONE=0,VPX_IMG_FMT_RGB24=1,VPX_IMG_FMT_RGB32=2,VPX_IMG_FMT_RGB565=3,VPX_IMG_FMT_RGB555=4,VPX_IMG_FMT_UYVY=5,VPX_IMG_FMT_YUY2=6,VPX_IMG_FMT_YVYU=7,VPX_IMG_FMT_BGR24=8,VPX_IMG_FMT_RGB32_LE=9,VPX_IMG_FMT_ARGB=10,VPX_IMG_FMT_ARGB_LE=11,VPX_IMG_FMT_RGB565_LE=12,VPX_IMG_FMT_RGB555_LE=13,VPX_IMG_FMT_YV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|1,VPX_IMG_FMT_I420=2|VPX_IMG_FMT_PLANAR,VPX_IMG_FMT_VPXYV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|3,VPX_IMG_FMT_VPXI420=4|VPX_IMG_FMT_PLANAR,IMG_FMT_PLANAR=VPX_IMG_FMT_PLANAR,IMG_FMT_UV_FLIP=VPX_IMG_FMT_UV_FLIP,IMG_FMT_HAS_ALPHA=VPX_IMG_FMT_HAS_ALPHA,IMG_FMT_NONE=VPX_IMG_FMT_NONE,IMG_FMT_RGB24=VPX_IMG_FMT_RGB24,IMG_FMT_RGB32=VPX_IMG_FMT_RGB32,IMG_FMT_RGB565=VPX_IMG_FMT_RGB565,IMG_FMT_RGB555=VPX_IMG_FMT_RGB555,IMG_FMT_UYVY=VPX_IMG_FMT_UYVY,IMG_FMT_YUY2=VPX_IMG_FMT_YUY2,IMG_FMT_YVYU=VPX_IMG_FMT_YVYU,IMG_FMT_BGR24=VPX_IMG_FMT_BGR24,IMG_FMT_RGB32_LE=VPX_IMG_FMT_RGB32_LE,IMG_FMT_ARGB=VPX_IMG_FMT_ARGB,IMG_FMT_ARGB_LE=VPX_IMG_FMT_ARGB_LE,IMG_FMT_RGB565_LE=VPX_IMG_FMT_RGB565_LE,IMG_FMT_RGB555_LE=VPX_IMG_FMT_RGB555_LE,IMG_FMT_YV12=VPX_IMG_FMT_YV12,IMG_FMT_I420=VPX_IMG_FMT_I420,IMG_FMT_VPXYV12=VPX_IMG_FMT_VPXYV12,IMG_FMT_VPXI420=VPX_IMG_FMT_VPXI420;function img_alloc_helper(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_,E=int_,c=int_;switch(n||(n=1),n&n-1&&alert("goto fail"),e){case VPX_IMG_FMT_RGB32:case VPX_IMG_FMT_RGB32_LE:case VPX_IMG_FMT_ARGB:case VPX_IMG_FMT_ARGB_LE:E=32;break;case VPX_IMG_FMT_RGB24:case VPX_IMG_FMT_BGR24:E=24;break;case VPX_IMG_FMT_RGB565:case VPX_IMG_FMT_RGB565_LE:case VPX_IMG_FMT_RGB555:case VPX_IMG_FMT_RGB555_LE:case VPX_IMG_FMT_UYVY:case VPX_IMG_FMT_YUY2:case VPX_IMG_FMT_YVYU:E=16;break;case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:E=12;break;default:E=16}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:f=1;break;default:f=0}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:d=1;break;default:d=0}return o=r+(c=(1<<f)-1)&~c,a=t+(c=(1<<d)-1)&~c,s=(s=e&VPX_IMG_FMT_PLANAR?o:E*o/8)+n-1&~(n-1),_||((_=new vpx_image_t)||alert("goto fail"),_.self_allocd=1),_.img_data=i,i||(_.img_data=malloc(e&VPX_IMG_FMT_PLANAR?a*o*E/8:a*s,0),_.img_data_owner=1),_.img_data||alert("goto fail"),_.fmt=_.fmt=e,_.w=_.w=o,_.h=_.h=a,_.x_chroma_shift=_.x_chroma_shift=f,_.y_chroma_shift=_.y_chroma_shift=d,_.bps=_.bps=E,_.stride[VPX_PLANE_Y]=_.stride[VPX_PLANE_ALPHA]=s,_.stride[VPX_PLANE_U]=_.stride[VPX_PLANE_V]=s>>f,vpx_img_set_rect(_,0,0,r,t)?(vpx_img_free(_),null):_}function vpx_img_alloc(_,e,r,t,n){return img_alloc_helper(_,e,r,t,n,null)}function vpx_img_set_rect(_,e,r,t,n){var i=char_,a=0;return e+t<=_.w&&r+n<=_.h?(_.d_w=_.d_w=t,_.d_h=_.d_h=n,_.fmt&VPX_IMG_FMT_PLANAR?(i=_.img_data,a=_.img_data_off,_.fmt&VPX_IMG_FMT_HAS_ALPHA&&(_.planes[VPX_PLANE_ALPHA]=i,_.planes_off[VPX_PLANE_ALPHA]=a+e+r*_.stride[VPX_PLANE_ALPHA],a+=_.h*_.stride[VPX_PLANE_ALPHA]),_.planes[VPX_PLANE_Y]=i,_.planes_off[VPX_PLANE_Y]=a+e+r*_.stride[VPX_PLANE_Y],a+=_.h*_.stride[VPX_PLANE_Y],_.fmt&VPX_IMG_FMT_UV_FLIP?(_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U]):(_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V])):(_.planes[VPX_PLANE_PACKED]=_.img_data,_.img_data_of,parseInt(e*_.bps/8+r*_.stride[VPX_PLANE_PACKED],10)),0):-1}function vpx_img_free(_){_&&(_.img_data&&_.img_data_owner&&(_.img_data=""),_.self_allocd&&(_=""))}var bool_decoder=function(){this.input=char_,this.input_off=0,this.input_len=size_t,this.range=int_,this.value=int_,this.bit_count=int_};function init_bool_decoder(_,e,r,t){t>=2?(_.value=e[r+0]<<8|e[r+1],_.input=e,_.input_off=r+2,_.input_len=t-2):(_.value=0,_.input=null,_.input_len=0),_.range=255,_.bit_count=0}function bool_get(_,e){var r=1+((_.range-1)*e>>8),t=r<<8,n=int_;for(_.value>=t?(n=1,_.range-=r,_.value-=t):(n=0,_.range=r);_.range<128;)_.value<<=1,_.range<<=1,8==++_.bit_count&&(_.bit_count=0,_.input_len&&(_.value|=_.input[_.input_off++],_.input_len--));return n}function bool_get_bit(_){return bool_get(_,128)}function bool_get_uint(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return r}function bool_get_int(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return bool_get_bit(_)?-r:r}function bool_maybe_get_int(_,e){return bool_get_bit(_)?bool_get_int(_,e):0}function bool_read_tree(_,e,r,t){var n=0;if(void 0!==t)for(;(n=e[n+bool_get(_,r[t+(n>>1)])])>0;);else for(;(n=e[n+bool_get(_,r[n>>1])])>0;);return-n}function BITS_MASK(_){return(1<<_)-1}function BITS_GET(_,e,r){return _>>e&BITS_MASK(r)}var vp8_frame_hdr=function(){this.is_keyframe=int_,this.is_experimental=int_,this.version=int_,this.is_shown=int_,this.part0_sz=int_,this.kf=new Object({w:int_,h:int_,scale_w:int_,scale_h:int_}),this.frame_size_updated=int_},MB_FEATURE_TREE_PROBS=3,MAX_MB_SEGMENTS=4,vp8_segment_hdr=function(){this.enabled=int_,this.update_data=int_,this.update_map=int_,this.abs_=int_,this.tree_probs=new Array(MB_FEATURE_TREE_PROBS),this.lf_level=new Array(MAX_MB_SEGMENTS),this.quant_idx=new Array(MAX_MB_SEGMENTS)},BLOCK_CONTEXTS=4,vp8_loopfilter_hdr=function(){this.use_simple=int_,this.level=int_,this.sharpness=int_,this.delta_enabled=int_,this.ref_delta=new Array(BLOCK_CONTEXTS),this.mode_delta=new Array(BLOCK_CONTEXTS)},MAX_PARTITIONS=8,vp8_token_hdr=function(){this.partitions=int_,this.partition_sz=new Array(MAX_PARTITIONS)},vp8_quant_hdr=function(){this.q_index=int_,this.delta_update=int_,this.y1_dc_delta_q=int_,this.y2_dc_delta_q=int_,this.y2_ac_delta_q=int_,this.uv_dc_delta_q=int_,this.uv_ac_delta_q=int_},vp8_reference_hdr=function(){this.refresh_last=int_,this.refresh_gf=int_,this.refresh_arf=int_,this.copy_gf=int_,this.copy_arf=int_,this.sign_bias=new Array(4),this.refresh_entropy=int_},BLOCK_TYPES=4,PREV_COEF_CONTEXTS=3,COEF_BANDS=8,ENTROPY_NODES=11,coeff_probs_table_t=function(){return ArrM(new Array(BLOCK_TYPES,COEF_BANDS,PREV_COEF_CONTEXTS,ENTROPY_NODES),char_)},MV_PROB_CNT=19,mv_component_probs_t=function(){return new Array(MV_PROB_CNT)},Arr_1056=Arr(1056,0),vp8_entropy_hdr=function(){this.coeff_probs=new coeff_probs_table_t,this.coeff_probs_=Arr(1056,0),this.mv_probs=Arr_new(2,mv_component_probs_t),this.coeff_skip_enabled=int_,this.coeff_skip_prob=char_,this.y_mode_probs=new Array(0,0,0,0),this.uv_mode_probs=new Array(0,0,0),this.prob_inter=char_,this.prob_last=char_,this.prob_gf=char_},CURRENT_FRAME=0,LAST_FRAME=1,GOLDEN_FRAME=2,ALTREF_FRAME=3,NUM_REF_FRAMES=4,filter_t=function(){return new Array(6)},mv=function(){this.d={x:int16_t,y:int16_t}},mb_base_info=function(){this.y_mode=char_,this.uv_mode=char_,this.segment_id=char_,this.ref_frame=char_,this.skip_coeff=char_,this.need_mc_border=char_,this.partitioning=null,this.mv=new mv,this.eob_mask=int_},mb_info=function(){this.base=new mb_base_info,this.splitt=new Object({mvs:Arr_new(16,mv),modes:new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)})},token_entropy_ctx_t=function(){return new Array(9)},token_decoder=function(){this.bool=new bool_decoder,this.left_token_entropy_ctx=new token_entropy_ctx_t,this.coeffs=short_},TOKEN_BLOCK_Y1=0,TOKEN_BLOCK_UV=1,TOKEN_BLOCK_Y2=2,TOKEN_BLOCK_TYPES=3,dequant_factors=function(){this.quant_idx=int_,this.factor=ArrM(new Array(TOKEN_BLOCK_TYPES,2),short_)},ref_cnt_img=function(){this.img=new vpx_image_t,this.ref_cnt=int_},vp8_decoder_ctx=function(){this.error=[],this.frame_cnt=int_,this.frame_hdr=new vp8_frame_hdr,this.segment_hdr=new vp8_segment_hdr,this.loopfilter_hdr=new vp8_loopfilter_hdr,this.token_hdr=new vp8_token_hdr,this.quant_hdr=new vp8_quant_hdr,this.reference_hdr=new vp8_reference_hdr,this.entropy_hdr=new vp8_entropy_hdr,this.saved_entropy=new vp8_entropy_hdr,this.saved_entropy_valid=int_,this.mb_rows=int_,this.mb_cols=int_,this.mb_info_storage=null,this.mb_info_storage_off=0,this.mb_info_storage_object=mb_info,this.mb_info_rows_storage=null,this.mb_info_rows_storage_off=0,this.mb_info_rows_storage_object=mb_info,this.mb_info_rows=null,this.mb_info_rows_off=0,this.above_token_entropy_ctx=null,this.above_token_entropy_ctx_object=token_entropy_ctx_t,this.tokens=Arr_new(MAX_PARTITIONS,token_decoder),this.dequant_factors=Arr_new(MAX_MB_SEGMENTS,dequant_factors),this.frame_strg=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frames=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frame_offsets=new Array(0,0,0,0),this.ref_frame_offsets_=new Array(0,0,0,0),this.subpixel_filters=new filter_t};function CLAMP_255(_){return _<0?0:_>255?255:_}function vp8_dixie_walsh(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=int_,d=int_,E=int_,c=int_,l=_,m=e,A=r,u=t;for(n=0;n<4;n++)i=l[m+0]+l[m+12],a=l[m+4]+l[m+8],o=l[m+4]-l[m+8],s=l[m+0]-l[m+12],A[u+0]=i+a,A[u+4]=o+s,A[u+8]=i-a,A[u+12]=s-o,m++,u++;for(l=r,m=t,A=r,u=t,n=0;n<4;n++)f=(i=l[m+0]+l[m+3])+(a=l[m+1]+l[m+2]),d=(o=l[m+1]-l[m+2])+(s=l[m+0]-l[m+3]),E=i-a,c=s-o,A[u+0]=f+3>>3,A[u+1]=d+3>>3,A[u+2]=E+3>>3,A[u+3]=c+3>>3,m+=4,u+=4}var cospi8sqrt2minus1=20091,sinpi8sqrt2=35468;function idct_columns(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=_,d=e,E=r,c=t;for(n=0;n<4;n++)i=f[d+0]+f[d+8],a=f[d+0]-f[d+8],o=(f[d+4]*sinpi8sqrt2>>16)-(f[d+12]+(f[d+12]*cospi8sqrt2minus1>>16)),s=f[d+4]+(f[d+4]*cospi8sqrt2minus1>>16)+(f[d+12]*sinpi8sqrt2>>16),E[c+0]=i+s,E[c+12]=i-s,E[c+4]=a+o,E[c+8]=a-o,d++,c++}var tmp_2=Arr(16,0);function vp8_dixie_idct_add(_,e,r,t,n,i,a){var o=int_,s=int_,f=int_,d=int_,E=int_;for(idct_columns(i,a,tmp_2,0),i=tmp_2,a=0,o=0;o<4;o++)s=i[a+0]+i[a+2],f=i[a+0]-i[a+2],d=(i[a+1]*sinpi8sqrt2>>16)-(i[a+3]+(i[a+3]*cospi8sqrt2minus1>>16)),E=i[a+1]+(i[a+1]*cospi8sqrt2minus1>>16)+(i[a+3]*sinpi8sqrt2>>16),_[e+0]=r[t+0]+(s+E+4>>3),_[e+3]=r[t+3]+(s-E+4>>3),_[e+1]=r[t+1]+(f+d+4>>3),_[e+2]=r[t+2]+(f-d+4>>3),a+=4,e+=n,t+=n}var k_coeff_entropy_update_probs=new Array(new Array(new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(176,246,255,255,255,255,255,255,255,255,255),new Array(223,241,252,255,255,255,255,255,255,255,255),new Array(249,253,253,255,255,255,255,255,255,255,255)),new Array(new Array(255,244,252,255,255,255,255,255,255,255,255),new Array(234,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,246,254,255,255,255,255,255,255,255,255),new Array(239,253,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(251,255,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(251,254,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,254,255,255,255,255,255,255),new Array(250,255,254,255,254,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(217,255,255,255,255,255,255,255,255,255,255),new Array(225,252,241,253,255,255,254,255,255,255,255),new Array(234,250,241,250,253,255,253,254,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(223,254,254,255,255,255,255,255,255,255,255),new Array(238,253,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(249,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,255,255,255,255,255,255,255,255,255),new Array(247,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(252,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(186,251,250,255,255,255,255,255,255,255,255),new Array(234,251,244,254,255,255,255,255,255,255,255),new Array(251,251,243,253,254,255,254,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(236,253,254,255,255,255,255,255,255,255,255),new Array(251,253,253,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(254,254,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(254,254,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(248,255,255,255,255,255,255,255,255,255,255),new Array(250,254,252,254,255,255,255,255,255,255,255),new Array(248,254,249,253,255,255,255,255,255,255,255)),new Array(new Array(255,253,253,255,255,255,255,255,255,255,255),new Array(246,253,253,255,255,255,255,255,255,255,255),new Array(252,254,251,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,252,255,255,255,255,255,255,255,255),new Array(248,254,253,255,255,255,255,255,255,255,255),new Array(253,255,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,251,254,255,255,255,255,255,255,255,255),new Array(245,251,254,255,255,255,255,255,255,255,255),new Array(253,253,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,251,253,255,255,255,255,255,255,255,255),new Array(252,253,254,255,255,255,255,255,255,255,255),new Array(255,254,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,252,255,255,255,255,255,255,255,255,255),new Array(249,255,254,255,255,255,255,255,255,255,255),new Array(255,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)))),k_default_y_mode_probs=new Array(112,86,140,37),k_default_uv_mode_probs=new Array(162,101,204),k_default_coeff_probs=new Array(new Array(new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128)),new Array(new Array(253,136,254,255,228,219,128,128,128,128,128),new Array(189,129,242,255,227,213,255,219,128,128,128),new Array(106,126,227,252,214,209,255,255,128,128,128)),new Array(new Array(1,98,248,255,236,226,255,255,128,128,128),new Array(181,133,238,254,221,234,255,154,128,128,128),new Array(78,134,202,247,198,180,255,219,128,128,128)),new Array(new Array(1,185,249,255,243,255,128,128,128,128,128),new Array(184,150,247,255,236,224,128,128,128,128,128),new Array(77,110,216,255,236,230,128,128,128,128,128)),new Array(new Array(1,101,251,255,241,255,128,128,128,128,128),new Array(170,139,241,252,236,209,255,255,128,128,128),new Array(37,116,196,243,228,255,255,255,128,128,128)),new Array(new Array(1,204,254,255,245,255,128,128,128,128,128),new Array(207,160,250,255,238,128,128,128,128,128,128),new Array(102,103,231,255,211,171,128,128,128,128,128)),new Array(new Array(1,152,252,255,240,255,128,128,128,128,128),new Array(177,135,243,255,234,225,128,128,128,128,128),new Array(80,129,211,255,194,224,128,128,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(246,1,255,128,128,128,128,128,128,128,128),new Array(255,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(198,35,237,223,193,187,162,160,145,155,62),new Array(131,45,198,221,172,176,220,157,252,221,1),new Array(68,47,146,208,149,167,221,162,255,223,128)),new Array(new Array(1,149,241,255,221,224,255,255,128,128,128),new Array(184,141,234,253,222,220,255,199,128,128,128),new Array(81,99,181,242,176,190,249,202,255,255,128)),new Array(new Array(1,129,232,253,214,197,242,196,255,255,128),new Array(99,121,210,250,201,198,255,202,128,128,128),new Array(23,91,163,242,170,187,247,210,255,255,128)),new Array(new Array(1,200,246,255,234,255,128,128,128,128,128),new Array(109,178,241,255,231,245,255,255,128,128,128),new Array(44,130,201,253,205,192,255,255,128,128,128)),new Array(new Array(1,132,239,251,219,209,255,165,128,128,128),new Array(94,136,225,251,218,190,255,255,128,128,128),new Array(22,100,174,245,186,161,255,199,128,128,128)),new Array(new Array(1,182,249,255,232,235,128,128,128,128,128),new Array(124,143,241,255,227,234,128,128,128,128,128),new Array(35,77,181,251,193,211,255,205,128,128,128)),new Array(new Array(1,157,247,255,236,231,255,255,128,128,128),new Array(121,141,235,255,225,227,255,255,128,128,128),new Array(45,99,188,251,195,217,255,224,128,128,128)),new Array(new Array(1,1,251,255,213,255,128,128,128,128,128),new Array(203,1,248,255,255,128,128,128,128,128,128),new Array(137,1,177,255,224,255,128,128,128,128,128))),new Array(new Array(new Array(253,9,248,251,207,208,255,192,128,128,128),new Array(175,13,224,243,193,185,249,198,255,255,128),new Array(73,17,171,221,161,179,236,167,255,234,128)),new Array(new Array(1,95,247,253,212,183,255,255,128,128,128),new Array(239,90,244,250,211,209,255,255,128,128,128),new Array(155,77,195,248,188,195,255,255,128,128,128)),new Array(new Array(1,24,239,251,218,219,255,205,128,128,128),new Array(201,51,219,255,196,186,128,128,128,128,128),new Array(69,46,190,239,201,218,255,228,128,128,128)),new Array(new Array(1,191,251,255,255,128,128,128,128,128,128),new Array(223,165,249,255,213,255,128,128,128,128,128),new Array(141,124,248,255,255,128,128,128,128,128,128)),new Array(new Array(1,16,248,255,255,128,128,128,128,128,128),new Array(190,36,230,255,236,255,128,128,128,128,128),new Array(149,1,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,226,255,128,128,128,128,128,128,128,128),new Array(247,192,255,128,128,128,128,128,128,128,128),new Array(240,128,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,134,252,255,255,128,128,128,128,128,128),new Array(213,62,250,255,255,128,128,128,128,128,128),new Array(55,93,255,128,128,128,128,128,128,128,128)),new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(202,24,213,235,186,191,220,160,240,175,255),new Array(126,38,182,232,169,184,228,174,255,187,128),new Array(61,46,138,219,151,178,240,170,255,216,128)),new Array(new Array(1,112,230,250,199,191,247,159,255,255,128),new Array(166,109,228,252,211,215,255,174,128,128,128),new Array(39,77,162,232,172,180,245,178,255,255,128)),new Array(new Array(1,52,220,246,198,199,249,220,255,255,128),new Array(124,74,191,243,183,193,250,221,255,255,128),new Array(24,71,130,219,154,170,243,182,255,255,128)),new Array(new Array(1,182,225,249,219,240,255,224,128,128,128),new Array(149,150,226,252,216,205,255,171,128,128,128),new Array(28,108,170,242,183,194,254,223,255,255,128)),new Array(new Array(1,81,230,252,204,203,255,192,128,128,128),new Array(123,102,209,247,188,196,255,233,128,128,128),new Array(20,95,153,243,164,173,255,203,128,128,128)),new Array(new Array(1,222,248,255,216,213,128,128,128,128,128),new Array(168,175,246,252,235,205,255,255,128,128,128),new Array(47,116,215,255,211,212,255,255,128,128,128)),new Array(new Array(1,121,236,253,212,214,255,255,128,128,128),new Array(141,84,213,252,201,202,255,219,128,128,128),new Array(42,80,160,240,162,185,255,205,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(244,1,255,128,128,128,128,128,128,128,128),new Array(238,1,255,128,128,128,128,128,128,128,128)))),k_mv_entropy_update_probs=new Array(new Array(237,246,253,253,254,254,254,254,254,254,254,254,254,254,250,250,252,254,254),new Array(231,243,245,253,254,254,254,254,254,254,254,254,254,254,251,251,254,254,254)),k_default_mv_probs=function(){return new Array(new Array(162,128,225,146,172,147,214,39,156,128,129,132,75,145,178,206,239,254,254),new Array(164,128,204,170,119,235,140,230,228,128,130,130,74,148,180,203,236,254,254))},dc_q_lookup=new Array(4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157),ac_q_lookup=new Array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284),kf_y_mode_probs=new Array(145,156,163,128),kf_uv_mode_probs=new Array(142,114,183),kf_b_mode_probs=new Array(new Array(new Array(231,120,48,89,115,113,120,152,112),new Array(152,179,64,126,170,118,46,70,95),new Array(175,69,143,80,85,82,72,155,103),new Array(56,58,10,171,218,189,17,13,152),new Array(144,71,10,38,171,213,144,34,26),new Array(114,26,17,163,44,195,21,10,173),new Array(121,24,80,195,26,62,44,64,85),new Array(170,46,55,19,136,160,33,206,71),new Array(63,20,8,114,114,208,12,9,226),new Array(81,40,11,96,182,84,29,16,36)),new Array(new Array(134,183,89,137,98,101,106,165,148),new Array(72,187,100,130,157,111,32,75,80),new Array(66,102,167,99,74,62,40,234,128),new Array(41,53,9,178,241,141,26,8,107),new Array(104,79,12,27,217,255,87,17,7),new Array(74,43,26,146,73,166,49,23,157),new Array(65,38,105,160,51,52,31,115,128),new Array(87,68,71,44,114,51,15,186,23),new Array(47,41,14,110,182,183,21,17,194),new Array(66,45,25,102,197,189,23,18,22)),new Array(new Array(88,88,147,150,42,46,45,196,205),new Array(43,97,183,117,85,38,35,179,61),new Array(39,53,200,87,26,21,43,232,171),new Array(56,34,51,104,114,102,29,93,77),new Array(107,54,32,26,51,1,81,43,31),new Array(39,28,85,171,58,165,90,98,64),new Array(34,22,116,206,23,34,43,166,73),new Array(68,25,106,22,64,171,36,225,114),new Array(34,19,21,102,132,188,16,76,124),new Array(62,18,78,95,85,57,50,48,51)),new Array(new Array(193,101,35,159,215,111,89,46,111),new Array(60,148,31,172,219,228,21,18,111),new Array(112,113,77,85,179,255,38,120,114),new Array(40,42,1,196,245,209,10,25,109),new Array(100,80,8,43,154,1,51,26,71),new Array(88,43,29,140,166,213,37,43,154),new Array(61,63,30,155,67,45,68,1,209),new Array(142,78,78,16,255,128,34,197,171),new Array(41,40,5,102,211,183,4,1,221),new Array(51,50,17,168,209,192,23,25,82)),new Array(new Array(125,98,42,88,104,85,117,175,82),new Array(95,84,53,89,128,100,113,101,45),new Array(75,79,123,47,51,128,81,171,1),new Array(57,17,5,71,102,57,53,41,49),new Array(115,21,2,10,102,255,166,23,6),new Array(38,33,13,121,57,73,26,1,85),new Array(41,10,67,138,77,110,90,47,114),new Array(101,29,16,10,85,128,101,196,26),new Array(57,18,10,102,102,213,34,20,43),new Array(117,20,15,36,163,128,68,1,26)),new Array(new Array(138,31,36,171,27,166,38,44,229),new Array(67,87,58,169,82,115,26,59,179),new Array(63,59,90,180,59,166,93,73,154),new Array(40,40,21,116,143,209,34,39,175),new Array(57,46,22,24,128,1,54,17,37),new Array(47,15,16,183,34,223,49,45,183),new Array(46,17,33,183,6,98,15,32,183),new Array(65,32,73,115,28,128,23,128,205),new Array(40,3,9,115,51,192,18,6,223),new Array(87,37,9,115,59,77,64,21,47)),new Array(new Array(104,55,44,218,9,54,53,130,226),new Array(64,90,70,205,40,41,23,26,57),new Array(54,57,112,184,5,41,38,166,213),new Array(30,34,26,133,152,116,10,32,134),new Array(75,32,12,51,192,255,160,43,51),new Array(39,19,53,221,26,114,32,73,255),new Array(31,9,65,234,2,15,1,118,73),new Array(88,31,35,67,102,85,55,186,85),new Array(56,21,23,111,59,205,45,37,192),new Array(55,38,70,124,73,102,1,34,98)),new Array(new Array(102,61,71,37,34,53,31,243,192),new Array(69,60,71,38,73,119,28,222,37),new Array(68,45,128,34,1,47,11,245,171),new Array(62,17,19,70,146,85,55,62,70),new Array(75,15,9,9,64,255,184,119,16),new Array(37,43,37,154,100,163,85,160,1),new Array(63,9,92,136,28,64,32,201,85),new Array(86,6,28,5,64,255,25,248,1),new Array(56,8,17,132,137,255,55,116,128),new Array(58,15,20,82,135,57,26,121,40)),new Array(new Array(164,50,31,137,154,133,25,35,218),new Array(51,103,44,131,131,123,31,6,158),new Array(86,40,64,135,148,224,45,183,128),new Array(22,26,17,131,240,154,14,1,209),new Array(83,12,13,54,192,255,68,47,28),new Array(45,16,21,91,64,222,7,1,197),new Array(56,21,39,155,60,138,23,102,213),new Array(85,26,85,85,128,128,32,146,171),new Array(18,11,7,63,144,171,4,4,246),new Array(35,27,10,146,174,171,12,26,128)),new Array(new Array(190,80,35,99,180,80,126,54,45),new Array(85,126,47,87,176,51,41,20,32),new Array(101,75,128,139,118,146,116,128,85),new Array(56,41,15,176,236,85,37,9,62),new Array(146,36,19,30,171,255,97,27,20),new Array(71,30,17,119,118,255,17,18,138),new Array(101,38,60,138,55,70,43,26,142),new Array(138,45,61,62,219,1,81,188,64),new Array(32,41,20,117,151,142,20,21,163),new Array(112,19,12,61,195,128,48,4,24))),kf_y_mode_tree=new Array(-B_PRED,2,4,6,-DC_PRED,-V_PRED,-H_PRED,-TM_PRED),y_mode_tree=new Array(-DC_PRED,2,4,6,-V_PRED,-H_PRED,-TM_PRED,-B_PRED),uv_mode_tree=new Array(-DC_PRED,2,-V_PRED,4,-H_PRED,-TM_PRED),b_mode_tree=new Array(-B_DC_PRED,2,-B_TM_PRED,4,-B_VE_PRED,6,8,12,-B_HE_PRED,10,-B_RD_PRED,-B_VR_PRED,-B_LD_PRED,14,-B_VL_PRED,16,-B_HD_PRED,-B_HU_PRED),small_mv_tree=new Array(2,8,4,6,-0,-1,-2,-3,10,12,-4,-5,-6,-7),mv_ref_tree=new Array(-ZEROMV,2,-NEARESTMV,4,-NEARMV,6,-NEWMV,-SPLITMV),submv_ref_tree=new Array(-LEFT4X4,2,-ABOVE4X4,4,-ZERO4X4,-NEW4X4),split_mv_tree=new Array(-3,2,-2,4,-0,-1),default_b_mode_probs=new Array(120,90,79,133,87,85,80,111,151),mv_counts_to_probs=new Array(new Array(7,1,1,143),new Array(14,18,14,107),new Array(135,64,57,68),new Array(60,56,128,65),new Array(159,134,128,34),new Array(234,188,128,28)),split_mv_probs=new Array(110,111,150),submv_ref_probs2=new Array(new Array(147,136,18),new Array(106,145,1),new Array(179,121,1),new Array(223,1,34),new Array(208,1,1)),mv_partitions=new Array(new Array(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1),new Array(0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1),new Array(0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3),new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)),mv_clamp_rect=function(){this.to_left=int_,this.to_right=int_,this.to_top=int_,this.to_bottom=int_};function clamp_mv(_,e){var r=new mv;return r.d.x=_.d.x<e.to_left?e.to_left:_.d.x,r.d.x=_.d.x>e.to_right?e.to_right:r.d.x,r.d.y=_.d.y<e.to_top?e.to_top:_.d.y,r.d.y=_.d.y>e.to_bottom?e.to_bottom:r.d.y,r}function read_segment_id(_,e){return bool_get(_,e.tree_probs[0])?2+bool_get(_,e.tree_probs[2]):bool_get(_,e.tree_probs[1])}function above_block_mode(_,e,r){if(r<4)switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+12].d.x;default:assert(0)}return _.splitt.mvs[r-4].d.x}function left_block_mode(_,e,r){if(!(3&r))switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+3].d.x;default:assert(0)}return _.splitt.mvs[r-1].d.x}function decode_kf_mb_mode(_,e,r,t,n,i,a){var o,s;if((o=bool_read_tree(a,kf_y_mode_tree,kf_y_mode_probs))==B_PRED){var f=int_;for(f=0;f<16;f++){var d,E=above_block_mode(_[e],n[i],f),c=left_block_mode(_[e],r[t],f);d=bool_read_tree(a,b_mode_tree,kf_b_mode_probs[E][c]),_[e].splitt.modes[f]=_[e].splitt.mvs[f].d.x=d,_[e].splitt.mvs[f].d.y=0}}s=bool_read_tree(a,uv_mode_tree,kf_uv_mode_probs),_[e].base.y_mode=o,_[e].base.uv_mode=s,_[e].base.mv.d.x=_[e].base.mv.d.y=0,_[e].base.ref_frame=0}function decode_intra_mb_mode(_,e,r){var t,n;if((t=bool_read_tree(r,y_mode_tree,e.y_mode_probs))==B_PRED){var i=int_;for(i=0;i<16;i++){var a;a=bool_read_tree(r,b_mode_tree,default_b_mode_probs),_.splitt.modes[i]=_.splitt.mvs[i].d.x=a,_.splitt.mvs[i].d.y=0}}n=bool_read_tree(r,uv_mode_tree,e.uv_mode_probs),_.base.y_mode=t,_.base.uv_mode=n,_.base.mv.d.x=_.base.mv.d.y=0,_.base.ref_frame=CURRENT_FRAME}function read_mv_component(_,e){var r=0;if(bool_get(_,e[0])){var t=0;for(t=0;t<3;t++)r+=bool_get(_,e[9+t])<<t;for(t=9;t>3;t--)r+=bool_get(_,e[9+t])<<t;65520&r&&!bool_get(_,e[12])||(r+=8)}else r=bool_read_tree(_,small_mv_tree,e,2);return r&&bool_get(_,e[1])&&(r=-r),r<<1}function above_block_mv(_,e,r){return r<4?e.base.y_mode==SPLITMV?e.splitt.mvs[r+12]:e.base.mv:_.splitt.mvs[r-4]}function left_block_mv(_,e,r){return 3&r?_.splitt.mvs[r-1]:e.base.y_mode==SPLITMV?e.splitt.mvs[r+3]:e.base.mv}function submv_ref(_,e,r){var t=!(e.d.x||e.d.y)+0,n=!(r.d.x||r.d.y)+0,i=(e.d.x==r.d.x&&e.d.y==r.d.y)+0,a=0;return i&&t?a=4:i?a=3:n?a=2:t&&(a=1),bool_read_tree(_,submv_ref_tree,submv_ref_probs2[a])}function read_mv(_,e,r){e.d.y=read_mv_component(_,r[0]),e.d.x=read_mv_component(_,r[1])}function mv_bias(_,e,r,t){e[_.base.ref_frame]^e[r]&&(t.d.x*=-1,t.d.y*=-1)}var CNT_BEST=0,CNT_ZEROZERO=0,CNT_NEAREST=1,CNT_NEAR=2,CNT_SPLITMV=3,this_mv_1=new mv,this_mv_2=new mv;function find_near_mvs(_,e,r,t,n,i,a,o){var s=t,f=n-1,d=a,E=0,c=o,l=0;d[0].d.x=d[1].d.x=d[2].d.x=0,d[0].d.y=d[1].d.y=d[2].d.y=0,o[0]=o[1]=o[2]=o[3]=0;var m,A=t[n],u=e[r],p=s[f];(A.base.ref_frame!=CURRENT_FRAME&&((A.base.mv.d.x||A.base.mv.d.y)&&(d[++E].d.x=A.base.mv.d.x,d[E].d.y=A.base.mv.d.y,mv_bias(A,i,_.base.ref_frame,d[E]),++l),c[l]+=2),u.base.ref_frame!=CURRENT_FRAME)&&(u.base.mv.d.x||u.base.mv.d.y?((m=this_mv_1).d.x=u.base.mv.d.x,m.d.y=u.base.mv.d.y,mv_bias(u,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=2):o[CNT_ZEROZERO]+=2);p.base.ref_frame!=CURRENT_FRAME&&(p.base.mv.d.x||p.base.mv.d.y?((m=this_mv_2).d.x=p.base.mv.d.x,m.d.y=p.base.mv.d.y,mv_bias(p,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=1):o[CNT_ZEROZERO]+=1);if(o[CNT_SPLITMV]&&d[E].d.x==a[CNT_NEAREST].d.x&&d[E].d.y==a[CNT_NEAREST].d.y&&(o[CNT_NEAREST]+=1),o[CNT_SPLITMV]=2*((A.base.y_mode==SPLITMV)+(u.base.y_mode==SPLITMV))+(p.base.y_mode==SPLITMV),o[CNT_NEAR]>o[CNT_NEAREST]){var T,y=int_;y=o[CNT_NEAREST],o[CNT_NEAREST]=o[CNT_NEAR],o[CNT_NEAR]=y,y=a[CNT_NEAREST].d.x,T=a[CNT_NEAREST].d.y,a[CNT_NEAREST].d.x=a[CNT_NEAR].d.x,a[CNT_NEAREST].d.y=a[CNT_NEAR].d.y,a[CNT_NEAR].d.x=y,a[CNT_NEAR].d.y=T}o[CNT_NEAREST]>=o[CNT_BEST]&&(a[CNT_BEST].d.x=a[CNT_NEAREST].d.x,a[CNT_BEST].d.y=a[CNT_NEAREST].d.y)}function decode_split_mv(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_;for(o=bool_read_tree(i,split_mv_tree,split_mv_probs),a=mv_partitions[o],_.base.partitioning=o,s=0,d=0;d<65535;s++){var E,c,l=new mv;for(f=0;s!=a[f];f++);switch(submv_ref(i,E=left_block_mv(_,e,f),c=above_block_mv(_,r,f))){case LEFT4X4:l=E;break;case ABOVE4X4:l=c;break;case ZERO4X4:l.d.x=l.d.y=0;break;case NEW4X4:read_mv(i,l,t.mv_probs),l.d.x+=n.d.x,l.d.y+=n.d.y;break;default:assert(0)}for(;f<16;f++)s==a[f]&&(_.splitt.mvs[f].d.x=l.d.x,_.splitt.mvs[f].d.y=l.d.y,d|=1<<f)}}function need_mc_border(_,e,r,t,n,i){return e+=_.d.x>>3,r+=_.d.y>>3,e>>1<2||n-(e+t)>>1<3||r>>1<2||i-(r+t)>>1<3}var near_mvs_4=Arr_new(4,mv),mv_cnts_4=new Array(0,0,0,0),probs_4=new Array(0,0,0,0),chroma_mv_4=Arr_new(4,mv),clamped_best_mv_1=new mv;function decode_mvs(_,e,r,t,n,i,a,o,s){var f,d,E,c,l=_.entropy_hdr,m=near_mvs_4,A=clamped_best_mv_1,u=mv_cnts_4,p=probs_4,T=int_;switch(e[r].base.ref_frame=bool_get(s,l.prob_last)?2+bool_get(s,l.prob_gf):1,find_near_mvs(e[r],e,r-1,i,a,_.reference_hdr.sign_bias,m,u),p[0]=mv_counts_to_probs[u[0]][0],p[1]=mv_counts_to_probs[u[1]][1],p[2]=mv_counts_to_probs[u[2]][2],p[3]=mv_counts_to_probs[u[3]][3],(e=e[r]).base.y_mode=bool_read_tree(s,mv_ref_tree,p),e.base.uv_mode=e.base.y_mode,e.base.need_mc_border=0,f=-o.to_left-128>>3,d=-o.to_top-128>>3,E=16*_.mb_cols,c=16*_.mb_rows,e.base.y_mode){case NEARESTMV:e.base.mv=clamp_mv(m[1],o);break;case NEARMV:e.base.mv=clamp_mv(m[2],o);break;case ZEROMV:return void(e.base.mv.d.x=e.base.mv.d.y=0);case NEWMV:A=clamp_mv(m[0],o),read_mv(s,e.base.mv,l.mv_probs),e.base.mv.d.x+=A.d.x,e.base.mv.d.y+=A.d.y;break;case SPLITMV:var y=chroma_mv_4;for(A=clamp_mv(m[0],o),decode_split_mv(e,t[n],i[a],l,A,s),e.base.mv.d.x=e.splitt.mvs[15].d.x,e.base.mv.d.y=e.splitt.mvs[15].d.y,T=0;T<16;T++)if(y[(T>>1&1)+(T>>2&2)].d.x+=e.splitt.mvs[T].d.x,y[(T>>1&1)+(T>>2&2)].d.y+=e.splitt.mvs[T].d.y,need_mc_border(e.splitt.mvs[T],f+4*(3&T),d+(-4&T),4,E,c)){e.base.need_mc_border=1;break}for(T=0;T<4;T++)if(y[T].d.x+=4,y[T].d.y+=4,y[T].d.x>>=2,y[T].d.y>>=2,need_mc_border(y[T],f+8*(1&T),d+8*(T>>1),16,E,c)){e.base.need_mc_border=1;break}return;default:assert(0)}need_mc_border(e.base.mv,f,d,16,E,c)&&(e.base.need_mc_border=1)}var bounds_=new mv_clamp_rect;function vp8_dixie_modemv_process_row(_,e,r,t,n){var i,a,o=0,s=0,f=int_,d=bounds_;for(a=_.mb_info_rows[1+r],s=_.mb_info_rows_off[1+r]+t,i=_.mb_info_rows[1+r-1],o=_.mb_info_rows_off[1+r-1]+t,d.to_left=-(t+1<<7),d.to_right=_.mb_cols-t<<7,d.to_top=-(r+1<<7),d.to_bottom=_.mb_rows-r<<7,f=t;f<t+n;f++)_.segment_hdr.update_map&&(a[s].base.segment_id=read_segment_id(e,_.segment_hdr)),_.entropy_hdr.coeff_skip_enabled&&(a[s].base.skip_coeff=bool_get(e,_.entropy_hdr.coeff_skip_prob)),_.frame_hdr.is_keyframe?(_.segment_hdr.update_map||(a[s].base.segment_id=0),decode_kf_mb_mode(a,s,a,s-1,i,o,e)):(bool_get(e,_.entropy_hdr.prob_inter)?decode_mvs(_,a,s,a,s-1,i,o,d,e):decode_intra_mb_mode(a[s],_.entropy_hdr,e),d.to_left-=128,d.to_right-=128),s++,o++}function vp8_dixie_modemv_init(_){var e,r,t=int_,n=new mb_info,i=0;for(e=_.mb_cols+1,r=_.mb_rows+1,_.frame_hdr.frame_size_updated&&(_.mb_info_storage=null,_.mb_info_rows_storage=null),_.mb_info_storage||(_.mb_info_storage=Arr_new(e*r,_.mb_info_storage_object),_.mb_info_storage_off=0),_.mb_info_rows_storage||(_.mb_info_rows_storage=Arr_new(r,_.mb_info_rows_storage_object),_.mb_info_rows_storage_off=new Array(r)),n=_.mb_info_storage,i=_.mb_info_storage_off+1,t=0;t<r;t++)_.mb_info_rows_storage[t]=n,_.mb_info_rows_storage_off[t]=i,i+=e;_.mb_info_rows=_.mb_info_rows_storage,_.mb_info_rows_off=_.mb_info_rows_storage_off}var EOB_CONTEXT_NODE=0,ZERO_CONTEXT_NODE=1,ONE_CONTEXT_NODE=2,LOW_VAL_CONTEXT_NODE=3,TWO_CONTEXT_NODE=4,THREE_CONTEXT_NODE=5,HIGH_LOW_CONTEXT_NODE=6,CAT_ONE_CONTEXT_NODE=7,CAT_THREEFOUR_CONTEXT_NODE=8,CAT_THREE_CONTEXT_NODE=9,CAT_FIVE_CONTEXT_NODE=10,ZERO_TOKEN=0,ONE_TOKEN=1,TWO_TOKEN=2,THREE_TOKEN=3,FOUR_TOKEN=4,DCT_VAL_CATEGORY1=5,DCT_VAL_CATEGORY2=6,DCT_VAL_CATEGORY3=7,DCT_VAL_CATEGORY4=8,DCT_VAL_CATEGORY5=9,DCT_VAL_CATEGORY6=10,DCT_EOB_TOKEN=11,MAX_ENTROPY_TOKENS=12,left_context_index=new Array(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8),above_context_index=new Array(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,5,4,5,6,7,6,7,8);function X(_){return _*PREV_COEF_CONTEXTS*ENTROPY_NODES}var bands_x=new Array(X(0),X(1),X(2),X(3),X(6),X(4),X(5),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(7)),extrabits=new Array({min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:1,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:2,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:3,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:4,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:5,length:0,probs:new Array(159,0,0,0,0,0,0,0,0,0,0,0)},{min_val:7,length:1,probs:new Array(145,165,0,0,0,0,0,0,0,0,0,0)},{min_val:11,length:2,probs:new Array(140,148,173,0,0,0,0,0,0,0,0,0)},{min_val:19,length:3,probs:new Array(135,140,155,176,0,0,0,0,0,0,0,0)},{min_val:35,length:4,probs:new Array(130,134,141,157,180,0,0,0,0,0,0,0)},{min_val:67,length:10,probs:new Array(129,130,133,140,153,177,196,230,243,254,254,0)},{min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)}),zigzag=new Array(0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15),BLOCK_LOOP=0,DO_WHILE=1,CHECK_0_=2,CAT_FIVE_CONTEXT_NODE_0_=3,CAT_THREEFOUR_CONTEXT_NODE_0_=4,CAT_THREE_CONTEXT_NODE_0_=5,HIGH_LOW_CONTEXT_NODE_0_=6,CAT_ONE_CONTEXT_NODE_0_=7,LOW_VAL_CONTEXT_NODE_0_=8,THREE_CONTEXT_NODE_0_=9,TWO_CONTEXT_NODE_0_=10,ONE_CONTEXT_NODE_0_=11,BLOCK_FINISHED=12,END=13;function decode_mb_tokens(_,e,r,t,n,i,a,o){function s(e){y=(bool_get_bit(_)?-e:e)*P[!!p+0]}function f(e,r){if(!bool_get(_,e))return g=r,1}function d(e,r){if(!bool_get(_,e))return D=R,p<15?(++p,D+=bands_x[p],g=r,1):(g=BLOCK_FINISHED,1)}function E(_){return s(_),D=R+2*ENTROPY_NODES,p<15?(w[I+zigzag[p]]=y,++p,g=DO_WHILE,1):(w[I+zigzag[15]]=y,g=BLOCK_FINISHED,1)}function c(e,r){b+=bool_get(_,extrabits[e].probs[r])<<r}var l,m=int_,A=int_,u=int_,p=int_,T=int_,y=int_,b=int_,v=int_,h=int_,w=short_,I=0,R=0,N=char_,D=0,P=short_;h=0,i!=B_PRED&&i!=SPLITMV?(m=24,A=24,u=1,w=t,I=n+384,P=o[TOKEN_BLOCK_Y2]):(m=0,A=16,u=3,w=t,I=n,P=o[TOKEN_BLOCK_Y1]),l=a,R=u*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES;var g=BLOCK_LOOP;do{if(g==BLOCK_LOOP&&(T=e[left_context_index[m]]+r[above_context_index[m]],p=!u+0,N=l,D=R,D+=T*ENTROPY_NODES,g=DO_WHILE),g==DO_WHILE){if(f(N[(D+=bands_x[p])+EOB_CONTEXT_NODE],BLOCK_FINISHED))continue;g=CHECK_0_}if(g==CHECK_0_){if(d(N[D+ZERO_CONTEXT_NODE],CHECK_0_))continue;if(f(N[D+ONE_CONTEXT_NODE],ONE_CONTEXT_NODE_0_))continue;if(f(N[D+LOW_VAL_CONTEXT_NODE],LOW_VAL_CONTEXT_NODE_0_))continue;if(f(N[D+HIGH_LOW_CONTEXT_NODE],HIGH_LOW_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_THREEFOUR_CONTEXT_NODE],CAT_THREEFOUR_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_FIVE_CONTEXT_NODE],CAT_FIVE_CONTEXT_NODE_0_))continue;b=extrabits[DCT_VAL_CATEGORY6].min_val,v=extrabits[DCT_VAL_CATEGORY6].length;do{c(DCT_VAL_CATEGORY6,v),v--}while(v>=0);if(E(b))continue}if(g!=CAT_FIVE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY5].min_val,c(DCT_VAL_CATEGORY5,4),c(DCT_VAL_CATEGORY5,3),c(DCT_VAL_CATEGORY5,2),c(DCT_VAL_CATEGORY5,1),c(DCT_VAL_CATEGORY5,0),!E(b))){if(g==CAT_THREEFOUR_CONTEXT_NODE_0_){if(f(N[D+CAT_THREE_CONTEXT_NODE],CAT_THREE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY4].min_val,c(DCT_VAL_CATEGORY4,3),c(DCT_VAL_CATEGORY4,2),c(DCT_VAL_CATEGORY4,1),c(DCT_VAL_CATEGORY4,0),E(b))continue}if(g!=CAT_THREE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY3].min_val,c(DCT_VAL_CATEGORY3,2),c(DCT_VAL_CATEGORY3,1),c(DCT_VAL_CATEGORY3,0),!E(b))){if(g==HIGH_LOW_CONTEXT_NODE_0_){if(f(N[D+CAT_ONE_CONTEXT_NODE],CAT_ONE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY2].min_val,c(DCT_VAL_CATEGORY2,1),c(DCT_VAL_CATEGORY2,0),E(b))continue}if(g!=CAT_ONE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY1].min_val,c(DCT_VAL_CATEGORY1,0),!E(b))){if(g==LOW_VAL_CONTEXT_NODE_0_){if(f(N[D+TWO_CONTEXT_NODE],TWO_CONTEXT_NODE_0_))continue;if(f(N[D+THREE_CONTEXT_NODE],THREE_CONTEXT_NODE_0_))continue;if(E(4))continue}if(!(g==THREE_CONTEXT_NODE_0_&&E(3)||g==TWO_CONTEXT_NODE_0_&&E(2))){if(g==ONE_CONTEXT_NODE_0_){if(s(1),D=R+ENTROPY_NODES,p<15){w[I+zigzag[p]]=y,++p,g=DO_WHILE;continue}w[I+zigzag[15]]=y,g=BLOCK_FINISHED}if(g==BLOCK_FINISHED){if(h=((h=(h|(p>1)+0<<m)>>>0)|(T=(p!=!u)+0)<<31)>>>0,e[left_context_index[m]]=r[above_context_index[m]]=T,I+=16,++m<A){g=BLOCK_LOOP;continue}if(25==m){m=0,A=16,R=(u=0)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,I=n,P=o[TOKEN_BLOCK_Y1],g=BLOCK_LOOP;continue}if(16==m){R=(u=2)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,A=24,P=o[TOKEN_BLOCK_UV],g=BLOCK_LOOP;continue}}g=END}}}}}while(g!=END);return h}function reset_row_context(_){memset(_,0,0,_.length)}function reset_above_context(_,e){var r=0;for(r=0;r<e;++r)memset(_[r],0,0,_[r].length)}function reset_mb_context(_,e,r){memset(_,0,0,8),memset(e,0,0,8),r!=B_PRED&&r!=SPLITMV&&(_[8]=0,e[8]=0)}function vp8_dixie_tokens_process_row(_,e,r,t,n){var i=_.tokens[e],a=i.coeffs,o=400*t,s=int_,f=_.above_token_entropy_ctx,d=+t,E=i.left_token_entropy_ctx,c=_.mb_info_rows[1+r],l=_.mb_info_rows_off[1+r]+t;for(0==r&&reset_above_context(f,n),0==t&&reset_row_context(E),s=t;s<t+n;s++){if(memset(a,o,0,400),c[l].base.skip_coeff)reset_mb_context(E,f[d],c[l].base.y_mode),c[l].base.eob_mask=0;else{var m,A;m=_.dequant_factors,A=+c[l].base.segment_id,c[l].base.eob_mask=decode_mb_tokens(i.bool,E,f[d],a,o,c[l].base.y_mode,_.entropy_hdr.coeff_probs_,m[A].factor)}d++,l++,o+=400}}function vp8_dixie_tokens_init(_){var e=_.token_hdr.partitions;if(_.frame_hdr.frame_size_updated){var r=int_,t=25*_.mb_cols*16;for(r=0;r<e;r++)_.tokens[r].coeffs=new Array(t),_.tokens[r].coeffs||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null);_.above_token_entropy_ctx=Arr_new(_.mb_cols,_.above_token_entropy_ctx_object),_.above_token_entropy_ctx||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null)}}function ABS(_){return _>=0?_:-_}function saturate_int8(_){return _<-128?-128:_>127?127:_}function saturate_uint8(_){return _<0?0:_>255?255:_}function high_edge_variance(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return ABS(n-i)>t||ABS(o-a)>t}function simple_threshold(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return 2*ABS(i-a)+(ABS(n-o)>>1)<=t}function normal_threshold(_,e,r,t,n){var i=_[e-4*r],a=_[e-3*r],o=_[e-2*r],s=_[e-1*r],f=_[e+0*r],d=_[e+1*r],E=_[e+2*r],c=_[e+3*r],l=n;return simple_threshold(_,e,r,2*t+l)&&ABS(i-a)<=l&&ABS(a-o)<=l&&ABS(o-s)<=l&&ABS(c-E)<=l&&ABS(E-d)<=l&&ABS(d-f)<=l}function filter_common(_,e,r,t){var n,i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=int_;f=3*(o-a),t&&(f+=saturate_int8(i-s)),n=((f=saturate_int8(f))+4>127?127:f+4)>>3,a=saturate_uint8(a+((f+3>127?127:f+3)>>3)),o=saturate_uint8(o-n),t||(i=saturate_uint8(i+(f=n+1>>1)),s=saturate_uint8(s-f)),_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s}function filter_mb_edge(_,e,r){var t,n=_[e-3*r],i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=_[e+2*r],d=int_;a=saturate_uint8(a+(d=27*(t=saturate_int8(saturate_int8(i-s)+3*(o-a)))+63>>7)),o=saturate_uint8(o-d),i=saturate_uint8(i+(d=18*t+63>>7)),s=saturate_uint8(s-d),n=saturate_uint8(n+(d=9*t+63>>7)),f=saturate_uint8(f-d),_[e-3*r]=n,_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s,_[e+2*r]=f}function filter_mb_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&(high_edge_variance(_,e,1,i)?filter_common(_,e,1,1):filter_mb_edge(_,e,1)),e+=r}function filter_subblock_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&filter_common(_,e,1,high_edge_variance(_,e,1,i)),e+=r}function filter_mb_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&(high_edge_variance(_,e,r,i)?filter_common(_,e,r,1):filter_mb_edge(_,e,r)),e+=1}function filter_subblock_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&filter_common(_,e,r,high_edge_variance(_,e,r,i)),e+=1}function filter_v_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,1,t)&&filter_common(_,e,1,1),e+=r}function filter_h_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,r,t)&&filter_common(_,e,r,1),e+=1}function calculate_filter_parameters(_,e,r,t,n){var i=int_,a=int_,o=int_;i=_.loopfilter_hdr.level,_.segment_hdr.enabled&&(_.segment_hdr.abs_?i=_.segment_hdr.lf_level[e.base.segment_id]:i+=_.segment_hdr.lf_level[e.base.segment_id]),_.loopfilter_hdr.delta_enabled&&(i+=_.loopfilter_hdr.ref_delta[e.base.ref_frame],e.base.ref_frame==CURRENT_FRAME?e.base.y_mode==B_PRED&&(i+=_.loopfilter_hdr.mode_delta[0]):e.base.y_mode==ZEROMV?i+=_.loopfilter_hdr.mode_delta[1]:e.base.y_mode==SPLITMV?i+=_.loopfilter_hdr.mode_delta[3]:i+=_.loopfilter_hdr.mode_delta[2]),i>63?i=63:i<0&&(i=0),a=i,_.loopfilter_hdr.sharpness&&(a>>=_.loopfilter_hdr.sharpness>4?2:1)>9-_.loopfilter_hdr.sharpness&&(a=9-_.loopfilter_hdr.sharpness),a<1&&(a=1),o=i>=15,i>=40&&o++,i>=20&&!_.frame_hdr.is_keyframe&&o++,r[0]=i,t[0]=a,n[0]=o}function filter_row_normal(_,e,r,t){var n,i,a,o,s,f,d=0,E=0,c=0,l=0,m=int_;for(o=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],s=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],d=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],i=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],E=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],c=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],d+=16*(o*e+r),E+=8*(s*e+r),c+=8*(s*e+r),f=_.mb_info_rows[1+e],l=_.mb_info_rows_off[1+e]+r,m=r;m<r+t;m++){var A=[int_],u=[int_],p=[int_];calculate_filter_parameters(_,f[l],A,u,p),A=A[0],u=u[0],p=p[0],A&&(m&&(filter_mb_v_edge(n,d,o,A+2,u,p,2),filter_mb_v_edge(i,E,s,A+2,u,p,1),filter_mb_v_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_v_edge(n,d+4,o,A,u,p,2),filter_subblock_v_edge(n,d+8,o,A,u,p,2),filter_subblock_v_edge(n,d+12,o,A,u,p,2),filter_subblock_v_edge(i,E+4,s,A,u,p,1),filter_subblock_v_edge(a,c+4,s,A,u,p,1)),e&&(filter_mb_h_edge(n,d,o,A+2,u,p,2),filter_mb_h_edge(i,E,s,A+2,u,p,1),filter_mb_h_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_h_edge(n,d+4*o,o,A,u,p,2),filter_subblock_h_edge(n,d+8*o,o,A,u,p,2),filter_subblock_h_edge(n,d+12*o,o,A,u,p,2),filter_subblock_h_edge(i,E+4*s,s,A,u,p,1),filter_subblock_h_edge(a,c+4*s,s,A,u,p,1))),d+=16,E+=8,c+=8,l++}}function filter_row_simple(_,e,r,t){var n,i,a,o=0,s=0,f=int_;for(i=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],o=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],o+=16*(i*e+r),a=_.mb_info_rows[1+e],s=_.mb_info_rows_off[1+e]+r,f=r;f<r+t;f++){var d=[int_],E=[int_],c=[int_];if(calculate_filter_parameters(_,a[s],d,E,c),d[0]){var l=(a[s].base.eob_mask||a[s].base.y_mode==SPLITMV||a[s].base.y_mode==B_PRED)+0,m=2*(d[0]+2)+E[0],A=2*d[0]+E[0];f&&filter_v_edge_simple(n,o,i,m),l&&(filter_v_edge_simple(n,o+4,i,A),filter_v_edge_simple(n,o+8,i,A),filter_v_edge_simple(n,o+12,i,A)),e&&filter_h_edge_simple(n,o,i,m),l&&(filter_h_edge_simple(n,o+4*i,i,A),filter_h_edge_simple(n,o+8*i,i,A),filter_h_edge_simple(n,o+12*i,i,A))}o+=16,s++}}function vp8_dixie_loopfilter_process_row(_,e,r,t){_.loopfilter_hdr.use_simple?filter_row_simple(_,e,r,t):filter_row_normal(_,e,r,t)}var BORDER_PIXELS=16,sixtap_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,-6,123,12,-1,0),new Array(2,-11,108,36,-8,1),new Array(0,-9,93,50,-6,0),new Array(3,-16,77,77,-16,3),new Array(0,-6,50,93,-9,0),new Array(1,-8,36,108,-11,2),new Array(0,-1,12,123,-6,0)),bilinear_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,0,112,16,0,0),new Array(0,0,96,32,0,0),new Array(0,0,80,48,0,0),new Array(0,0,64,64,0,0),new Array(0,0,48,80,0,0),new Array(0,0,32,96,0,0),new Array(0,0,16,112,0,0));function predict_h_nxn(_,e,r,t){var n=_,i=e-1,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+a*r]}function predict_v_nxn(_,e,r,t){var n=_,i=e-r,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+o]}function predict_tm_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=a[o-1],f=int_,d=int_;for(d=0;d<t;d++){for(f=0;f<t;f++)_[e+f]=CLAMP_255(n[i]+a[o+f]-s);e+=r,i+=r}}function predict_dc_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=int_,f=int_,d=0;for(s=0;s<t;s++)d+=n[i]+a[o+s],i+=r;switch(t){case 16:d=d+16>>5;break;case 8:d=d+8>>4;break;case 4:d=d+4>>3}for(s=0;s<t;s++)for(f=0;f<t;f++)_[e+s*r+f]=d}function predict_ve_4x4(_,e,r){var t=_,n=e-r,i=int_,a=int_;for(_[e+0]=t[n-1]+2*t[n+0]+t[n+1]+2>>2,_[e+1]=t[n+0]+2*t[n+1]+t[n+2]+2>>2,_[e+2]=t[n+1]+2*t[n+2]+t[n+3]+2>>2,_[e+3]=t[n+2]+2*t[n+3]+t[n+4]+2>>2,i=1;i<4;i++)for(a=0;a<4;a++)_[e+i*r+a]=_[e+a]}function predict_he_4x4(_,e,r){var t=_,n=e-1;_[e+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+0]+2>>2}function predict_ld_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-r;_[e+0]=s[f+0]+2*s[f+1]+s[f+2]+2>>2,_[e+1]=t=s[f+1]+2*s[f+2]+s[f+3]+2>>2,_[e+2]=n=s[f+2]+2*s[f+3]+s[f+4]+2>>2,_[e+3]=i=s[f+3]+2*s[f+4]+s[f+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=a=s[f+4]+2*s[f+5]+s[f+6]+2>>2,_[(e+=r)+0]=n,_[e+1]=i,_[e+2]=a,_[e+3]=o=s[f+5]+2*s[f+6]+s[f+7]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o,_[e+3]=s[f+6]+2*s[f+7]+s[f+7]+2>>2}function predict_rd_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1,d=_,E=e-r;_[e+0]=t=s[f+0]+2*d[E-1]+d[E+0]+2>>2,_[e+1]=n=d[E-1]+2*d[E+0]+d[E+1]+2>>2,_[e+2]=i=d[E+0]+2*d[E+1]+d[E+2]+2>>2,_[e+3]=d[E+1]+2*d[E+2]+d[E+3]+2>>2,_[(e+=r)+0]=a=s[f+r]+2*s[f+0]+d[E-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=o=s[f+2*r]+2*s[f+r]+s[f+0]+2>>2,_[e+1]=a,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=s[f+3*r]+2*s[f+2*r]+s[f+r]+2>>2,_[e+1]=o,_[e+2]=a,_[e+3]=t}function predict_vr_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=E[c-1]+E[c+0]+1>>1,_[e+1]=n=E[c+0]+E[c+1]+1>>1,_[e+2]=i=E[c+1]+E[c+2]+1>>1,_[e+3]=E[c+2]+E[c+3]+1>>1,_[(e+=r)+0]=a=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+1]=o=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+2]=s=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[e+3]=E[c+1]+2*E[c+2]+E[c+3]+2>>2,_[(e+=r)+0]=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+1]=a,_[e+2]=o,_[e+3]=s}function predict_vl_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-r;_[e+0]=f[d+0]+f[d+1]+1>>1,_[e+1]=t=f[d+1]+f[d+2]+1>>1,_[e+2]=n=f[d+2]+f[d+3]+1>>1,_[e+3]=i=f[d+3]+f[d+4]+1>>1,_[(e+=r)+0]=f[d+0]+2*f[d+1]+f[d+2]+2>>2,_[e+1]=a=f[d+1]+2*f[d+2]+f[d+3]+2>>2,_[e+2]=o=f[d+2]+2*f[d+3]+f[d+4]+2>>2,_[e+3]=s=f[d+3]+2*f[d+4]+f[d+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=f[d+4]+2*f[d+5]+f[d+6]+2>>2,_[(e+=r)+0]=a,_[e+1]=o,_[e+2]=s,_[e+3]=f[d+5]+2*f[d+6]+f[d+7]+2>>2}function predict_hd_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=f[d+0]+E[c-1]+1>>1,_[e+1]=n=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+2]=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+3]=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[(e+=r)+0]=i=f[d+r]+f[d+0]+1>>1,_[e+1]=a=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=o=f[d+2*r]+f[d+r]+1>>1,_[e+1]=s=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+2]=i,_[e+3]=a,_[(e+=r)+0]=f[d+3*r]+f[d+2*r]+1>>1,_[e+1]=f[d+3*r]+2*f[d+2*r]+f[d+r]+2>>2,_[e+2]=o,_[e+3]=s}function predict_hu_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1;_[e+0]=s[f+0*r]+s[f+1*r]+1>>1,_[e+1]=s[f+0*r]+2*s[f+1*r]+s[f+2*r]+2>>2,_[e+2]=t=s[f+1*r]+s[f+2*r]+1>>1,_[e+3]=n=s[f+1*r]+2*s[f+2*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i=s[f+2*r]+s[f+3*r]+1>>1,_[e+3]=a=s[f+2*r]+2*s[f+3*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o=s[f+3*r],_[e+3]=o,_[(e+=r)+0]=o,_[e+1]=o,_[e+2]=o,_[e+3]=o}function predict_h_16x16(_,e,r){predict_h_nxn(_,e,r,16)}function predict_v_16x16(_,e,r){predict_v_nxn(_,e,r,16)}function predict_tm_16x16(_,e,r){predict_tm_nxn(_,e,r,16)}function predict_h_8x8(_,e,r){predict_h_nxn(_,e,r,8)}function predict_v_8x8(_,e,r){predict_v_nxn(_,e,r,8)}function predict_tm_8x8(_,e,r){predict_tm_nxn(_,e,r,8)}function predict_tm_4x4(_,e,r){predict_tm_nxn(_,e,r,4)}var tmp_4=new Array(0,0,0,0);function copy_down(_,e,r){var t,n=_,i=e+16-r;for(t=0;t<4;++t)tmp_4[0+t]=n[i+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t]}function b_pred(_,e,r,t,n,i){var a=int_;for(copy_down(_,e,r),a=0;a<16;a++){var o=_,s=e+4*(3&a);switch(t.splitt.mvs[a].d.x){case B_DC_PRED:predict_dc_nxn(o,s,r,4);break;case B_TM_PRED:predict_tm_4x4(o,s,r);break;case B_VE_PRED:predict_ve_4x4(o,s,r);break;case B_HE_PRED:predict_he_4x4(o,s,r);break;case B_LD_PRED:predict_ld_4x4(o,s,r);break;case B_RD_PRED:predict_rd_4x4(o,s,r);break;case B_VR_PRED:predict_vr_4x4(o,s,r);break;case B_VL_PRED:predict_vl_4x4(o,s,r);break;case B_HD_PRED:predict_hd_4x4(o,s,r);break;case B_HU_PRED:predict_hu_4x4(o,s,r);break;default:assert(0)}vp8_dixie_idct_add(o,s,o,s,r,n,i),i+=16,3==(3&a)&&(e+=4*r)}}var y2_16=Arr(16,0);function fixup_dc_coeffs(_,e,r){var t=int_;for(vp8_dixie_walsh(e,r+384,y2_16,0),t=0;t<16;t++)e[r+16*t]=y2_16[t]}function predict_intra_luma(_,e,r,t,n,i){if(t.base.y_mode==B_PRED)b_pred(_,e,r,t,n,i);else{var a=int_;switch(t.base.y_mode){case DC_PRED:predict_dc_nxn(_,e,r,16);break;case V_PRED:predict_v_16x16(_,e,r);break;case H_PRED:predict_h_16x16(_,e,r);break;case TM_PRED:predict_tm_16x16(_,e,r);break;default:assert(0)}for(fixup_dc_coeffs(t,n,i),a=0;a<16;a++)vp8_dixie_idct_add(_,e,_,e,r,n,i),i+=16,e+=4,3==(3&a)&&(e+=4*r-16)}}function predict_intra_chroma(_,e,r,t,n,i,a,o){var s=int_;switch(i.base.uv_mode){case DC_PRED:predict_dc_nxn(_,e,n,8),predict_dc_nxn(r,t,n,8);break;case V_PRED:predict_v_8x8(_,e,n),predict_v_8x8(r,t,n);break;case H_PRED:predict_h_8x8(_,e,n),predict_h_8x8(r,t,n);break;case TM_PRED:predict_tm_8x8(_,e,n),predict_tm_8x8(r,t,n);break;default:assert(0)}for(o+=256,s=16;s<20;s++)vp8_dixie_idct_add(_,e,_,e,n,a,o),o+=16,e+=4,1&s&&(e+=4*n-8);for(s=20;s<24;s++)vp8_dixie_idct_add(r,t,r,t,n,a,o),o+=16,t+=4,1&s&&(t+=4*n-8)}function sixtap_horiz(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2]*s[0]+t[n-1]*s[1]+t[n+0]*s[2]+t[n+1]*s[3]+t[n+2]*s[4]+t[n+3]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}function sixtap_vert(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2*i]*s[0]+t[n-1*i]*s[1]+t[n+0*i]*s[2]+t[n+1*i]*s[3]+t[n+2*i]*s[4]+t[n+3*i]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}var temp_=new Array(336);function sixtap_2d(_,e,r,t,n,i,a,o,s,f,d){sixtap_horiz(temp_,0,16,t,n-2*i,i,a,o+5,d[s]),sixtap_vert(_,e,r,temp_,32,16,a,o,d[f])}var img_index=function(){this.y=char_,this.u=char_,this.v=char_,this.y_off=0,this.u_off=0,this.v_off=0,this.stride=int_,this.uv_stride=int_};function filter_block(_,e,r,t,n,i,a,o){var s,f;return a.d.x||a.d.y?(s=7&a.d.x,f=7&a.d.y,n+=(a.d.y>>3)*i+(a.d.x>>3),s|f&&(sixtap_2d(e,r,i,t,n,i,4,4,s,f,o),t=e,n=r),_[0]=n,t):(_[0]=n,t)}function recon_1_block(_,e,r,t,n,i,a,o,s,f,d){var E=[0];vp8_dixie_idct_add(_,e,filter_block(E,_,e,r,t,n,i,a),E[0],n,o,s+16*d)}function calculate_chroma_splitmv(_,e,r){var t=int_,n=new mv;return(t=_.splitt.mvs[e].d.x+_.splitt.mvs[e+1].d.x+_.splitt.mvs[e+4].d.x+_.splitt.mvs[e+5].d.x)<0?t-=4:t+=4,n.d.x=parseInt(t/8,10),(t=_.splitt.mvs[e].d.y+_.splitt.mvs[e+1].d.y+_.splitt.mvs[e+4].d.y+_.splitt.mvs[e+5].d.y)<0?t-=4:t+=4,n.d.y=parseInt(t/8,10),r&&(n.d.x&=-8,n.d.y&=-8),n}function build_mc_border(_,e,r,t,n,i,a,o,s,f,d){var E,c=char_;E=r,c=t-i-a*n,a>=d?c+=(d-1)*n:a>0&&(c+=a*n);do{var l,m=int_,A=0;(m=i<0?-i:0)>o&&(m=o),i+o>f&&(A=i+o-f),A>o&&(A=o),l=o-m-A,m&&memset(_,e,E[c+0],m),l&&memcpy(_,e+m,E,c+i+m,l),A&&memset(_,e+m+l,E[c+f-1],A),e+=n,++a<d&&a>0&&(c+=n)}while(--s)}function recon_1_edge_block(_,e,r,t,n,i,a,o,s,f,d,E,c,l,m,A,u){var p=u;c+=o.d.x>>3,l+=o.d.y>>3,(c<2||c+4-1+3>=m||l<2||l+4-1+3>=A)&&(build_mc_border(r,t,n,(i+=(o.d.x>>3)+(o.d.y>>3)*a)-2-2*a,a,c-2,l-2,9,9,m,A),n=r,i=t+2*a+2,i-=(o.d.x>>3)+(o.d.y>>3)*a);var T=[0];vp8_dixie_idct_add(_,e,filter_block(T,_,e,n,i,a,o,s),T[0],a,f,d+16*p)}var uvmv_1=new mv;function predict_inter_emulated_edge(_,e,r,t,n,i,a){var o,s,f,d=_.frame_strg[0].img.img_data,E=_.frame_strg[0].img.img_data_off,c=0,l=0,m=int_,A=int_,u=int_,p=int_,T=int_,y=Arr_new(4,mv),b=e.u,v=e.v,h=e.u_off,w=e.v_off,I=(3==_.frame_hdr.version)+0;if(u=16*i,p=16*a,m=16*_.mb_cols,A=16*_.mb_rows,s=e.y,l=e.y_off,f=_.ref_frame_offsets[n.base.ref_frame],o=_.ref_frame_offsets_[n.base.ref_frame],c=l+f,n.base.y_mode!=SPLITMV){var R=uvmv_1;R.d.x=n.base.mv.d.x,R.d.y=n.base.mv.d.y,R.d.x=R.d.x+1>>1,R.d.y=R.d.y+1>>1,I&&(R.d.x&=-8,R.d.y&=-8),y[0].d.x=R.d.x,y[0].d.y=R.d.y,y[1].d.x=R.d.x,y[1].d.y=R.d.y,y[2].d.x=R.d.x,y[2].d.y=R.d.y,y[3].d.x=R.d.x,y[3].d.y=R.d.y}else y[0]=calculate_chroma_splitmv(n,0,I),y[1]=calculate_chroma_splitmv(n,2,I),y[2]=calculate_chroma_splitmv(n,8,I),y[3]=calculate_chroma_splitmv(n,10,I);for(T=0;T<16;T++){var N;N=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+T],recon_1_edge_block(s,l,d,E,o,c,e.stride,N,_.subpixel_filters,r,t,n,u,p,m,A,T),u+=4,l+=4,c+=4,3==(3&T)&&(u-=16,p+=4,l+=4*e.stride-16,c+=4*e.stride-16)}for(u=16*i,p=16*a,u>>=1,p>>=1,m>>=1,A>>=1,T=0;T<4;T++)recon_1_edge_block(b,h,d,E,o,h+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+16),recon_1_edge_block(v,w,d,E,o,w+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+20),h+=4,w+=4,u+=4,1&T&&(u-=8,p+=4,h+=4*e.uv_stride-8,w+=4*e.uv_stride-8)}var uvmv_2=new mv;function predict_inter(_,e,r,t,n){var i,a,o=e.y,s=e.y_off,f=e.u,d=e.u_off,E=e.v,c=e.v_off,l=Arr_new(4,mv),m=(3==_.frame_hdr.version)+0,A=int_;if(n.base.y_mode!=SPLITMV){var u=uvmv_2;u.d.x=n.base.mv.d.x,u.d.y=n.base.mv.d.y,u.d.x=u.d.x+1>>1,u.d.y=u.d.y+1>>1,m&&(u.d.x&=-8,u.d.y&=-8),l[0].d.x=l[1].d.x=l[2].d.x=l[3].d.x=u.d.x,l[0].d.y=l[1].d.y=l[2].d.y=l[3].d.y=u.d.y}else l[0]=calculate_chroma_splitmv(n,0,m),l[1]=calculate_chroma_splitmv(n,2,m),l[2]=calculate_chroma_splitmv(n,8,m),l[3]=calculate_chroma_splitmv(n,10,m);for(a=_.ref_frame_offsets[n.base.ref_frame],i=_.ref_frame_offsets_[n.base.ref_frame],A=0;A<16;A++){var p;p=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+A],recon_1_block(o,s,i,s+a,e.stride,p,_.subpixel_filters,r,t,n,A),s+=4,3==(3&A)&&(s+=4*e.stride-16)}for(A=0;A<4;A++)recon_1_block(f,d,i,d+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+16),recon_1_block(E,c,i,c+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+20),d+=4,c+=4,1&A&&(d+=4*e.uv_stride-8,c+=4*e.uv_stride-8)}function vp8_dixie_release_ref_frame(_){_&&(assert(_.ref_cnt),_.ref_cnt--)}function vp8_dixie_ref_frame(_){return _.ref_cnt++,_}function vp8_dixie_find_free_ref_frame(_){var e=int_;for(e=0;e<NUM_REF_FRAMES;e++)if(0==_[e].ref_cnt)return _[e].ref_cnt=1,_[e];return assert(0),null}function fixup_left(_,e,r,t,n,i){var a=_,o=e-1,s=int_;if(i==DC_PRED&&n){var f=_,d=e-t;for(s=0;s<r;s++)a[o]=f[d+s],o+=t}else for(o-=t,s=-1;s<r;s++)a[o]=129,o+=t}function fixup_above(_,e,r,t,n,i){var a=_,o=e-t,s=int_;if(i==DC_PRED&&n){var f=_,d=e-1;for(s=0;s<r;s++)a[o+s]=f[d],d+=t}else memset(a,o-1,127,r+1);memset(a,o+r,127,4)}function vp8_dixie_predict_init(_){var e,r=int_;if(_.frame_hdr.frame_size_updated){for(r=0;r<NUM_REF_FRAMES;r++){var t=16*_.mb_cols+2*BORDER_PIXELS,n=16*_.mb_rows+2*BORDER_PIXELS;vpx_img_free(_.frame_strg[r].img),_.frame_strg[r].ref_cnt=0,_.ref_frames[r]=null,vpx_img_alloc(_.frame_strg[r].img,IMG_FMT_I420,t,n,16)||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,"Failed to allocate %dx%d framebuffer",t,n),vpx_img_set_rect(_.frame_strg[r].img,BORDER_PIXELS,BORDER_PIXELS,_.frame_hdr.kf.w,_.frame_hdr.kf.h)}_.frame_hdr.version?_.subpixel_filters=bilinear_filters:_.subpixel_filters=sixtap_filters}for(_.ref_frames[CURRENT_FRAME]&&vp8_dixie_release_ref_frame(_.ref_frames[CURRENT_FRAME]),_.ref_frames[CURRENT_FRAME]=vp8_dixie_find_free_ref_frame(_.frame_strg),e=_.ref_frames[CURRENT_FRAME].img.img_data,r=0;r<NUM_REF_FRAMES;r++){var i=_.ref_frames[r];_.ref_frame_offsets[r]=i?i.img.img_data_off-0:0,_.ref_frame_offsets_[r]=i?i.img.img_data:e}}var img_1=new img_index;function vp8_dixie_predict_process_row(_,e,r,t){var n,i,a=img_1,o=0,s=int_,f=0;for(a.stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],a.uv_stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],a.y=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],a.y_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],a.u=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],a.u_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a.v=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],a.v_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],a.y_off+=16*(a.stride*e+r),a.u_off+=8*(a.uv_stride*e+r),a.v_off+=8*(a.uv_stride*e+r),n=_.mb_info_rows[1+e],o=_.mb_info_rows_off[1+e]+r,i=_.tokens[e&_.token_hdr.partitions-1].coeffs,f=400*r,0==r&&(fixup_left(a.y,a.y_off,16,a.stride,e,n[o].base.y_mode),fixup_left(a.u,a.u_off,8,a.uv_stride,e,n[o].base.uv_mode),fixup_left(a.v,a.v_off,8,a.uv_stride,e,n[o].base.uv_mode),0==e&&(a.y[a.y_off-a.stride-1]=127)),s=r;s<r+t;s++)0==e&&(fixup_above(a.y,a.y_off,16,a.stride,s,n[o].base.y_mode),fixup_above(a.u,a.u_off,8,a.uv_stride,s,n[o].base.uv_mode),fixup_above(a.v,a.v_off,8,a.uv_stride,s,n[o].base.uv_mode)),n[o].base.y_mode<=B_PRED?(predict_intra_luma(a.y,a.y_off,a.stride,n[o],i,f),predict_intra_chroma(a.u,a.u_off,a.v,a.v_off,a.uv_stride,n[o],i,f)):(n[o].base.y_mode!=SPLITMV&&fixup_dc_coeffs(n[o],i,f),n[o].base.need_mc_border?predict_inter_emulated_edge(_,a,i,f,n[o],s,e):predict_inter(_,a,i,f,n[o])),o++,a.y_off+=16,a.u_off+=8,a.v_off+=8,f+=400;if(s==_.mb_cols){var d=a.y,E=a.y_off+15*a.stride,c=a.y[a.y_off-1+15*a.stride];d[E]=d[E+1]=d[E+2]=d[E+3]=c}}var FRAME_HEADER_SZ=3,KEYFRAME_HEADER_SZ=7;function ARRAY_COPY(_,e){assert(_.length==e.length),memcpy(_,0,e,0,_.length)}function decode_entropy_header(_,e,r){var t=int_,n=int_,i=int_,a=int_,o=0;for(t=0;t<BLOCK_TYPES;t++)for(n=0;n<COEF_BANDS;n++)for(i=0;i<PREV_COEF_CONTEXTS;i++)for(a=0;a<ENTROPY_NODES;a++)bool_get(e,k_coeff_entropy_update_probs[t][n][i][a])&&(r.coeff_probs_[o]=r.coeff_probs[t][n][i][a]=bool_get_uint(e,8)),o++;if(r.coeff_skip_enabled=bool_get_bit(e),r.coeff_skip_enabled&&(r.coeff_skip_prob=bool_get_uint(e,8)),!_.frame_hdr.is_keyframe){if(r.prob_inter=bool_get_uint(e,8),r.prob_last=bool_get_uint(e,8),r.prob_gf=bool_get_uint(e,8),bool_get_bit(e))for(t=0;t<4;t++)r.y_mode_probs[t]=bool_get_uint(e,8);if(bool_get_bit(e))for(t=0;t<3;t++)r.uv_mode_probs[t]=bool_get_uint(e,8);for(t=0;t<2;t++)for(n=0;n<MV_PROB_CNT;n++)if(bool_get(e,k_mv_entropy_update_probs[t][n])){var s=bool_get_uint(e,7);r.mv_probs[t][n]=s?s<<1:1}}}function decode_reference_header(_,e,r){var t=_.frame_hdr.is_keyframe;r.refresh_gf=t?1:bool_get_bit(e),r.refresh_arf=t?1:bool_get_bit(e),r.copy_gf=t||r.refresh_gf?0:bool_get_uint(e,2),r.copy_arf=t||r.refresh_arf?0:bool_get_uint(e,2),r.sign_bias[GOLDEN_FRAME]=t?0:bool_get_bit(e),r.sign_bias[ALTREF_FRAME]=t?0:bool_get_bit(e),r.refresh_entropy=bool_get_bit(e),r.refresh_last=t?1:bool_get_bit(e)}function decode_quantizer_header(_,e,r){var t=int_,n=r.q_index;r.q_index=bool_get_uint(e,7),t=(n!=r.q_index)+0,t|=r.y1_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_ac_delta_q=bool_maybe_get_int(e,4),t|=r.uv_dc_delta_q=bool_maybe_get_int(e,4),t|=r.uv_ac_delta_q=bool_maybe_get_int(e,4),r.delta_update=t}function decode_and_init_token_partitions(_,e,r,t,n,i){var a=int_;for(i.partitions=1<<bool_get_uint(e,2),n<3*(i.partitions-1)&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated packet found parsing partition lengths."),n-=3*(i.partitions-1),a=0;a<i.partitions;a++)a<i.partitions-1?(i.partition_sz[a]=r[t+2]<<16|r[t+1]<<8|r[t+0],t+=3):i.partition_sz[a]=n,n<i.partition_sz[a]&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated partition %d",a),n-=i.partition_sz[a];for(a=0;a<_.token_hdr.partitions;a++)init_bool_decoder(_.tokens[a].bool,r,t,_.token_hdr.partition_sz[a]),t+=_.token_hdr.partition_sz[a]}function decode_loopfilter_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.use_simple=bool_get_bit(e),r.level=bool_get_uint(e,6),r.sharpness=bool_get_uint(e,3),r.delta_enabled=bool_get_bit(e),r.delta_enabled&&bool_get_bit(e)){var t=int_;for(t=0;t<BLOCK_CONTEXTS;t++)r.ref_delta[t]=bool_maybe_get_int(e,6);for(t=0;t<BLOCK_CONTEXTS;t++)r.mode_delta[t]=bool_maybe_get_int(e,6)}}function decode_segmentation_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.enabled=bool_get_bit(e),r.enabled){var t=int_;if(r.update_map=bool_get_bit(e),r.update_data=bool_get_bit(e),r.update_data){for(r.abs_=bool_get_bit(e),t=0;t<MAX_MB_SEGMENTS;t++)r.quant_idx[t]=bool_maybe_get_int(e,7);for(t=0;t<MAX_MB_SEGMENTS;t++)r.lf_level[t]=bool_maybe_get_int(e,6)}if(r.update_map)for(t=0;t<MB_FEATURE_TREE_PROBS;t++)r.tree_probs[t]=bool_get_bit(e)?bool_get_uint(e,8):255}else r.update_map=0,r.update_data=0}function clamp_q(_){return _<0?0:_>127?127:_}function dc_q(_){return dc_q_lookup[clamp_q(_)]}function ac_q(_){return ac_q_lookup[clamp_q(_)]}function dequant_init(_,e,r){var t=int_,n=int_,i=_,a=0;for(t=0;t<(e.enabled?MAX_MB_SEGMENTS:1);t++)n=r.q_index,e.enabled&&(n=e.abs_?e.quant_idx[t]:n+e.quant_idx[t]),(i[a].quant_idx!=n||r.delta_update)&&(i[a].factor[TOKEN_BLOCK_Y1][0]=dc_q(n+r.y1_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y1][1]=ac_q(n),i[a].factor[TOKEN_BLOCK_UV][0]=dc_q(n+r.uv_dc_delta_q),i[a].factor[TOKEN_BLOCK_UV][1]=ac_q(n+r.uv_ac_delta_q),i[a].factor[TOKEN_BLOCK_Y2][0]=2*dc_q(n+r.y2_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y2][1]=parseInt(155*ac_q(n+r.y2_ac_delta_q)/100),i[a].factor[TOKEN_BLOCK_Y2][1]<8&&(i[a].factor[TOKEN_BLOCK_Y2][1]=8),i[a].factor[TOKEN_BLOCK_UV][0]>132&&(i[a].factor[TOKEN_BLOCK_UV][0]=132),i[a].quant_idx=n),a++}var bool_1=new bool_decoder;function decode_frame(_,e,r,t){var n,i=bool_1,a=int_,o=int_,s=int_;if(_.saved_entropy_valid=0,(n=vp8_parse_frame_header(e,t,_.frame_hdr))&&vpx_internal_error(_.error,n,"Failed to parse frame header"),_.frame_hdr.is_experimental&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Experimental bitstreams not supported."),r+=FRAME_HEADER_SZ,t-=FRAME_HEADER_SZ,_.frame_hdr.is_keyframe&&(r+=KEYFRAME_HEADER_SZ,t-=KEYFRAME_HEADER_SZ,_.mb_cols=parseInt((_.frame_hdr.kf.w+15)/16,10),_.mb_rows=parseInt((_.frame_hdr.kf.h+15)/16,10)),init_bool_decoder(i,e,r,_.frame_hdr.part0_sz),_.frame_hdr.is_keyframe&&bool_get_uint(i,2)&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Reserved bits not supported."),decode_segmentation_header(_,i,_.segment_hdr),decode_loopfilter_header(_,i,_.loopfilter_hdr),decode_and_init_token_partitions(_,i,e,r+_.frame_hdr.part0_sz,t-_.frame_hdr.part0_sz,_.token_hdr),decode_quantizer_header(_,i,_.quant_hdr),decode_reference_header(_,i,_.reference_hdr),_.frame_hdr.is_keyframe){a=int_;var f=int_,d=int_,E=int_,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)_.entropy_hdr.coeff_probs_[c]=_.entropy_hdr.coeff_probs[a][f][d][E]=k_default_coeff_probs[a][f][d][E],c++;_.entropy_hdr.mv_probs=new k_default_mv_probs,ARRAY_COPY(_.entropy_hdr.y_mode_probs,k_default_y_mode_probs),ARRAY_COPY(_.entropy_hdr.uv_mode_probs,k_default_uv_mode_probs)}if(!_.reference_hdr.refresh_entropy){var l=_.saved_entropy,m=_.entropy_hdr;c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=1}for(decode_entropy_header(_,i,_.entropy_hdr),vp8_dixie_modemv_init(_),vp8_dixie_tokens_init(_),vp8_dixie_predict_init(_),dequant_init(_.dequant_factors,_.segment_hdr,_.quant_hdr),o=0,s=0;o<_.mb_rows;o++)vp8_dixie_modemv_process_row(_,i,o,0,_.mb_cols),vp8_dixie_tokens_process_row(_,s,o,0,_.mb_cols),vp8_dixie_predict_process_row(_,o,0,_.mb_cols),_.loopfilter_hdr.level&&o&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),++s==_.token_hdr.partitions&&(s=0);if(_.loopfilter_hdr.level&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),_.frame_cnt++,!_.reference_hdr.refresh_entropy){l=_.entropy_hdr,m=_.saved_entropy,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E]=m.coeff_probs_[c],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=0}1==_.reference_hdr.copy_arf?(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[GOLDEN_FRAME])),1==_.reference_hdr.copy_gf?(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[ALTREF_FRAME])),_.reference_hdr.refresh_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_last&&(vp8_dixie_release_ref_frame(_.ref_frames[LAST_FRAME]),_.ref_frames[LAST_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME]))}function CHECK_FOR_UPDATE(_,e,r){var t=_;return r[0]|=t!=(_=e),_}function vp8_parse_frame_header(_,e,r){var t=long_;if(e<10)return VPX_CODEC_CORRUPT_FRAME;if(t=_[0]|_[1]<<8|_[2]<<16,r.is_keyframe=!BITS_GET(t,0,1),r.version=BITS_GET(t,1,2),r.is_experimental=BITS_GET(t,3,1),r.is_shown=BITS_GET(t,4,1),r.part0_sz=BITS_GET(t,5,19),e<=r.part0_sz+(r.is_keyframe?10:3))return VPX_CODEC_CORRUPT_FRAME;if(r.frame_size_updated=0,r.is_keyframe){var n=[0];if(157!=_[3]||1!=_[4]||42!=_[5])return VPX_CODEC_UNSUP_BITSTREAM;if(t=_[6]|_[7]<<8|_[8]<<16|_[9]<<24,r.kf.w=CHECK_FOR_UPDATE(r.kf.w,BITS_GET(t,0,14),n),r.kf.scale_w=CHECK_FOR_UPDATE(r.kf.scale_w,BITS_GET(t,14,2),n),r.kf.h=CHECK_FOR_UPDATE(r.kf.h,BITS_GET(t,16,14),n),r.kf.scale_h=CHECK_FOR_UPDATE(r.kf.scale_h,BITS_GET(t,30,2),n),r.frame_size_updated=n[0],!r.kf.w||!r.kf.h)return VPX_CODEC_UNSUP_BITSTREAM}return VPX_CODEC_OK}function vp8_dixie_decode_frame(_,e,r){var t=_;return _.error.error_code=VPX_CODEC_OK,_.error.has_detail=0,setjmp(_.error.jmp)||decode_frame(_,e,0,r),t.error.error_code}function vp8_dixie_decode_destroy(_){vp8_dixie_predict_destroy(_),vp8_dixie_tokens_destroy(_),vp8_dixie_modemv_destroy(_)}var vpx_codec_alg_priv=function(){decoder_ctx=new vp8_decoder_ctx,img=new vpx_image_t,img_avail=int_};function update_error_state(_,e){var r;return(r=e.error_code)&&(_.base.err_detail=e.has_detail?e.detail:null),r}function vp8_init(_){var e=VPX_CODEC_OK;if(!_.priv){var r=new vpx_codec_alg_priv_t;if(_.priv=r,!_.priv)return VPX_CODEC_MEM_ERROR;_.priv.sz=1,_.priv.iface=_.iface,_.priv.alg_priv=r,_.priv.init_flags=_.init_flags,_.config.dec&&(_.priv.alg_priv.cfg=_.config.dec,_.config.dec=_.priv.alg_priv.cfg)}return e}function vp8_destroy(_){return vp8_dixie_decode_destroy(_.decoder_ctx),_.base.alg_priv="",VPX_CODEC_OK}function vp8_peek_si(_,e,r){var t,n=new vp8_frame_hdr;return(t=vp8_parse_frame_header(_,e,n))||(r.is_kf=n.is_keyframe,r.is_kf?(r.w=n.kf.w,r.h=n.kf.h):(r.w=0,r.h=0)),t}function vp8_get_si(_,e){var r=int_;return r=(e.sz,1),memcpy(e,_.si,r),alert("todo"),e.sz=r,VPX_CODEC_OK}function vp8_decode(_,e,r,t,n){var i;return(i=vp8_dixie_decode_frame(_.decoder_ctx,e,r))&&update_error_state(_,_.decoder_ctx.error),_.img_avail=_.decoder_ctx.frame_hdr.is_shown,_.img=_.decoder_ctx.ref_frames[CURRENT_FRAME].img,i}function vp8_get_frame(_,e){var r=null;return _.img_avail&&(e[0]||(r=_.img,e[0]=r)),r}var ctf_maps=create_obj_vals_from_arrayChilds(vpx_codec_ctrl_fn_map_t,[[-1,null]]);function webmdata(_){main(_)}CODEC_INTERFACE("vpx_codec_vp8_dx",new Array('VP8 "Dixie" Decoder'+VERSION_STRING,VPX_CODEC_INTERNAL_ABI_VERSION,VPX_CODEC_CAP_DECODER,"vp8_init","vp8_destroy","ctf_maps",null,null,new Array("vp8_peek_si","vp8_get_si","vp8_decode","vp8_get_frame"))),window.webmdata=webmdata;var VP8_FOURCC=3690582,ifaces=new Array({name:char_,iface:0,fourcc:int_,fourcc_mask:int_});ifaces[0]={name:"vp8",iface:new vpx_codec_vp8_dx_algo,fourcc:VP8_FOURCC,fourcc_mask:16777215};var RAW_FILE=0,IVF_FILE=1,WEBM_FILE=2,IVF_FRAME_HDR_SZ=12,RAW_FRAME_HDR_SZ=4;function read_frame(_,e,r,t,n){new Array(IVF_FRAME_HDR_SZ);var i=size_t,a=_.infile;if(_.kind==WEBM_FILE){if(_.chunk>=_.chunks){var o=[int_];do{if(_.pkt&&nestegg_free_packet(_.pkt),nestegg_read_packet(_.nestegg_ctx,_.pkt)<=0||nestegg_packet_track(_.pkt,o))return 1}while(o!=_.video_track);if(nestegg_packet_count(_.pkt,_.chunks))return 1;_.chunk=0}return nestegg_packet_data(_.pkt,_.chunk,e,t)?1:(_.chunk++,0)}return t[0]=i,t?fread(e,1,t[0],a)!=t[0]?(fprintf(stderr,"Failed to read full frame\n"),1):0:1}var input_ctx=function(){this.kind=0,this.infile=0,this.nestegg_ctx=new nestegg,this.pkt=[null],this.chunk=int_,this.chunks=[int_],this.video_track=int_};function nestegg_read_cb(_,e,r){var t=r;return fread(_,1,e,t)<e&&feof(t)?0:1}function nestegg_seek_cb(_,e,r){switch(e){case NESTEGG_SEEK_SET:e=SEEK_SET;break;case NESTEGG_SEEK_CUR:e=SEEK_CUR;break;case NESTEGG_SEEK_END:e=SEEK_END}return fseek(r,_,e)?-1:0}function nestegg_tell_cb(_){return ftell(_)}function file_is_webm(_,e,r,t,n,i){var a=int_,o=[int_],s=-1,f={read:nestegg_read_cb,seek:nestegg_seek_cb,tell:nestegg_tell_cb,userdata:_.infile},d=new nestegg_video_params;for(_.nestegg_ctx=[_.nestegg_ctx],nestegg_init(_.nestegg_ctx,f,null)&&alert("goto fail"),_.nestegg_ctx=_.nestegg_ctx[0],nestegg_track_count(_.nestegg_ctx,o)&&alert("goto fail"),a=0;a<o&&(s=nestegg_track_type(_.nestegg_ctx,a))!=NESTEGG_TRACK_VIDEO;a++)s<0&&alert("goto fail");return nestegg_track_codec_id(_.nestegg_ctx,a)!=NESTEGG_CODEC_VP8&&(fprintf(stderr,"Not VP8 video, quitting.\n"),exit(1)),_.video_track=a,nestegg_track_video_params(_.nestegg_ctx,a,d)&&alert("goto fail"),n[0]=0,i[0]=0,e[0]=VP8_FOURCC,r[0]=d.width,t[0]=d.height,1}function main(_,e,r){var t=[null],n=[null],i=[0],a=[0],o={data:_,data_off:0},s=[int_],f=[int_],d=[int_],E=[int_],c=[int_],l=new input_ctx;if(l.infile=o,!file_is_webm(l,s,f,d,E,c))return alert("Unrecognized input file type.\n"),EXIT_FAILURE;l.kind=WEBM_FILE;var m=document.getElementById("timecode"),A=document.getElementById("render"),u=document.getElementById("frame"),p=new Date,T=0,y=new vp8_decoder_ctx;!function _(){!read_frame(l,t,n,i,a)&&setTimeout((function(){t=t[0],p=new Date,vp8_dixie_decode_frame(y,t,i),t=[t];var e=y.frame_hdr.is_shown,r=y.ref_frames[0].img;b=new Date,m.innerHTML=l.pkt[0].timecode+" ("+(l.pkt[0].timecode/1e9>>0)+" sec)",e&&(A.innerHTML=b-p+"ms<br />FPS:"+(1e3/(b-p)).toFixed(2),r&&vpximg2canvas(r),T++,u.innerHTML=T),_()}),0)}();var b=new Date}
@@ -1,25 +1,25 @@
1
- /**
2
- * jGestures: a jQuery plugin for gesture events
3
- * Copyright 2010, Neue Digitale / Razorfish GmbH
4
-
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- * This is still a beta version, bugfixes and improvements appreciated.
15
- * @copyright Neue Digitale / Razorfish GmbH
16
- * @author martin.krause@neue-digitale.de
17
- * @version 0.87
18
- *
19
- * @requires
20
- * jQuery JavaScript Library v1.4.2 - http://jquery.com/
21
- * Copyright 2010, John Resig
22
- * Dual licensed under the MIT or GPL Version 2 licenses.
23
- * http://jquery.org/license
24
- */
1
+ /**
2
+ * jGestures: a jQuery plugin for gesture events
3
+ * Copyright 2010, Neue Digitale / Razorfish GmbH
4
+
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ *
14
+ * This is still a beta version, bugfixes and improvements appreciated.
15
+ * @copyright Neue Digitale / Razorfish GmbH
16
+ * @author martin.krause@neue-digitale.de
17
+ * @version 0.87
18
+ *
19
+ * @requires
20
+ * jQuery JavaScript Library v1.4.2 - http://jquery.com/
21
+ * Copyright 2010, John Resig
22
+ * Dual licensed under the MIT or GPL Version 2 licenses.
23
+ * http://jquery.org/license
24
+ */
25
25
  !function(e){function t(e){e.startMove=e.startMove?e.startMove:{startX:null,startY:null,timestamp:null};var t=(new Date).getTime();if(e.touches){var s=[{lastX:e.deltaX,lastY:e.deltaY,moved:null,startX:e.screenX-e.startMove.screenX,startY:e.screenY-e.startMove.screenY}],r={vector:e.vector,orientation:window.orientation||null,lastX:s[0].lastX>0?1:s[0].lastX<0?-1:0,lastY:s[0].lastY>0?1:s[0].lastY<0?-1:0,startX:s[0].startX>0?1:s[0].startX<0?-1:0,startY:s[0].startY>0?1:s[0].startY<0?-1:0};s[0].moved=Math.sqrt(Math.pow(Math.abs(s[0].startX),2)+Math.pow(Math.abs(s[0].startY),2))}return{type:e.type||null,originalEvent:e.event||null,delta:s||null,direction:r||{orientation:window.orientation||null,vector:e.vector||null},duration:e.startMove.timestamp?t-e.timestamp:null,rotation:e.rotation||null,scale:e.scale||null,description:e.description||[e.type,":",e.touches,":",0!=s[0].lastX?s[0].lastX>0?"right":"left":"steady",":",0!=s[0].lastY?s[0].lastY>0?"down":"up":"steady"].join("")}}function s(t){e(window).triggerHandler("orientationchange",{direction:{orientation:window.orientation},description:["orientationchange:",["landscape:clockwise:","portrait:default:","landscape:counterclockwise:","portrait:upsidedown:"][window.orientation/90+1],window.orientation].join("")})}function r(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.touchstart,t),e.hasGestures?(t.currentTarget.addEventListener("touchmove",a,!1),t.currentTarget.addEventListener("touchend",o,!1)):(s.bind("mousemove",a),s.bind("mouseup",o));var r=s.data("ojQueryGestures"),n=t.touches?t.touches[0]:t,c={};c.oLastSwipemove={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},c.oStartTouch={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,c))}function a(s){var r=jQuery(s.currentTarget),a=r.data("ojQueryGestures"),o=!!s.touches,n=o?s.changedTouches[0].screenX:s.screenX,c=o?s.changedTouches[0].screenY:s.screenY,i=a.oLastSwipemove,u=n-i.screenX,h=c-i.screenY;if(a.oLastSwipemove){var p=t({type:"swipemove",touches:o?s.touches.length:"1",screenY:c,screenX:n,deltaY:h,deltaX:u,startMove:i,event:s,timestamp:i.timestamp});r.triggerHandler(p.type,p)}var d={},l=s.touches?s.touches[0]:s;d.oLastSwipemove={screenX:l.screenX,screenY:l.screenY,timestamp:(new Date).getTime()},r.data("ojQueryGestures",e.extend(!0,a,d))}function o(s){var r=jQuery(s.currentTarget),n=!!s.changedTouches,c=n?s.changedTouches.length:"1",i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY;r.triggerHandler(e.jGestures.events.touchendStart,s),e.hasGestures?(s.currentTarget.removeEventListener("touchmove",a,!1),s.currentTarget.removeEventListener("touchend",o,!1)):(r.unbind("mousemove",a),r.unbind("mouseup",o));var h,p=r.data("ojQueryGestures"),d=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdMove||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdMove,l=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdSwipe||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdSwipe;for(h in p){var w=p.oStartTouch,g=(i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY,i-w.screenX),v=t({type:"swipe",touches:c,screenY:u,screenX:i,deltaY:u-w.screenY,deltaX:g,startMove:w,event:s,timestamp:w.timestamp}),j=["zero","one","two","three","four"],m=!1;switch(h){case"swipeone":if(!1===n&&1==c&&!1===d)break;(!1===n||1==c&&!0===d&&!0===l)&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipetwo":n&&2==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipethree":n&&3==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipefour":n&&4==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":n&&!0===d&&!0===l&&(m=!0,v.type=["swipe",0!=v.delta[0].lastX?v.delta[0].lastX>0?"right":"left":"",0!=v.delta[0].lastY?v.delta[0].lastY>0?"down":"up":""].join(""),r.triggerHandler(v.type,v));break;case"tapone":case"taptwo":case"tapthree":case"tapfour":!0!==d&&!0!==m&&j[c]==h.slice(3)&&(v.description=["tap",j[c]].join(""),v.type=["tap",j[c]].join(""),r.triggerHandler(v.type,v))}var G={};r.data("ojQueryGestures",e.extend(!0,p,G)),r.data("ojQueryGestures",e.extend(!0,p,G))}r.triggerHandler(e.jGestures.events.touchendProcessed,s)}function n(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.gesturestart,t);var r=s.data("ojQueryGestures"),a={};a.oStartTouch={timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,a))}function c(s){var r,a,o,n,c=jQuery(s.currentTarget),i=c.data("ojQueryGestures");for(n in i)switch(n){case"pinch":((r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose||r>1&&r%1>e.jGestures.defaults.thresholdPinchopen)&&(a=r<1?-1:1,o=t({type:"pinch",scale:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["pinch:",a,":",r<1?"close":"open"].join("")}),c.triggerHandler(o.type,o));break;case"rotate":((r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw||r>1&&r>e.jGestures.defaults.thresholdRotatecw)&&(a=r<1?-1:1,o=t({type:"rotate",rotation:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["rotate:",a,":",r<1?"counterclockwise":"clockwise"].join("")}),c.triggerHandler(o.type,o))}}function i(s){var r,a=jQuery(s.currentTarget);a.triggerHandler(e.jGestures.events.gestureendStart,s);var o,n=a.data("ojQueryGestures");for(o in n)switch(o){case"pinchclose":(r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose&&a.triggerHandler("pinchclose",t({type:"pinchclose",scale:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:-1:close"}));break;case"pinchopen":(r=s.scale)>1&&r%1>e.jGestures.defaults.thresholdPinchopen&&a.triggerHandler("pinchopen",t({type:"pinchopen",scale:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:+1:open"}));break;case"rotatecw":(r=s.rotation)>1&&r>e.jGestures.defaults.thresholdRotatecw&&a.triggerHandler("rotatecw",t({type:"rotatecw",rotation:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:+1:clockwise"}));break;case"rotateccw":(r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw&&a.triggerHandler("rotateccw",t({type:"rotateccw",rotation:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:-1:counterclockwise"}))}a.triggerHandler(e.jGestures.events.gestureendProcessed,s)}e.jGestures={},e.jGestures.defaults={},e.jGestures.defaults.thresholdPinchopen=.05,e.jGestures.defaults.thresholdPinchmove=.05,e.jGestures.defaults.thresholdPinch=.05,e.jGestures.defaults.thresholdPinchclose=.05,e.jGestures.defaults.thresholdRotatecw=5,e.jGestures.defaults.thresholdRotateccw=5,e.jGestures.defaults.thresholdMove=20,e.jGestures.defaults.thresholdSwipe=100,e.jGestures.data={},e.jGestures.data.capableDevicesInUserAgentString=["iPad","iPhone","iPod","Mobile Safari"],e.jGestures.data.hasGestures=function(){var t;for(t=0;t<e.jGestures.data.capableDevicesInUserAgentString.length;t++)if(-1!==navigator.userAgent.indexOf(e.jGestures.data.capableDevicesInUserAgentString[t]))return!0;return!1}(),e.hasGestures=e.jGestures.data.hasGestures,e.jGestures.events={touchstart:"jGestures.touchstart",touchendStart:"jGestures.touchend;start",touchendProcessed:"jGestures.touchend;processed",gesturestart:"jGestures.gesturestart",gestureendStart:"jGestures.gestureend;start",gestureendProcessed:"jGestures.gestureend;processed"},jQuery.each({orientationchange_orientationchange01:"orientationchange",gestureend_pinchopen01:"pinchopen",gestureend_pinchclose01:"pinchclose",gestureend_rotatecw01:"rotatecw",gestureend_rotateccw01:"rotateccw",gesturechange_pinch01:"pinch",gesturechange_rotate01:"rotate",touchstart_swipe13:"swipemove",touchstart_swipe01:"swipeone",touchstart_swipe02:"swipetwo",touchstart_swipe03:"swipethree",touchstart_swipe04:"swipefour",touchstart_swipe05:"swipeup",touchstart_swipe06:"swiperightup",touchstart_swipe07:"swiperight",touchstart_swipe08:"swiperightdown",touchstart_swipe09:"swipedown",touchstart_swipe10:"swipeleftdown",touchstart_swipe11:"swipeleft",touchstart_swipe12:"swipeleftup",touchstart_tap01:"tapone",touchstart_tap02:"taptwo",touchstart_tap03:"tapthree",touchstart_tap04:"tapfour"},(function(t,u){jQuery.event.special[u]={setup:function(){var a=t.split("_"),o=a[0],u=a[1].slice(0,a[1].length-2),h=jQuery(this);if(!h.data("ojQueryGestures")||!h.data("ojQueryGestures")[o]){var p=h.data("ojQueryGestures")||{},d={};if(d[o]=!0,e.extend(!0,p,d),h.data("ojQueryGestures",p),e.hasGestures)switch(u){case"orientationchange":h.get(0).addEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":h.get(0).addEventListener("touchstart",r,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gestureend",i,!1);break;case"pinch":case"rotate":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gesturechange",c,!1)}else switch(u){case"tap":case"swipe":h.bind("mousedown",r)}}return!1},add:function(e){return jQuery(this).data("ojQueryGestures")[e.type]={originalType:e.type},!1},remove:function(e){var t=jQuery(this),s=t.data("ojQueryGestures");return s[e.type]=!1,t.data("ojQueryGestures",s),!1},teardown:function(){var u=t.split("_"),h=u[0],p=u[1].slice(0,u[1].length-2),d=jQuery(this);if(!d.data("ojQueryGestures")||!d.data("ojQueryGestures")[h]){var l=d.data("ojQueryGestures")||{},w={};if(w[h]=!1,e.extend(!0,l,w),d.data("ojQueryGestures",l),e.hasGestures)switch(p){case"orientationchange":d.get(0).removeEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":d.get(0).removeEventListener("touchstart",r,!1),d.get(0).removeEventListener("touchmove",a,!1),d.get(0).removeEventListener("touchend",o,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gestureend",i,!1);break;case"pinch":case"rotate":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gesturechange",c,!1)}else switch(p){case"tap":case"swipe":d.unbind("mousedown",r),d.unbind("mousemove",a),d.unbind("mouseup",o)}}return!1}}}))}(jQuery);