绍兴公厕前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
9.8 KiB

3 years ago
  1. function H265SPSParser(){function a(){g=0,h=new Map}function b(){if(l>=k)return 0;var a=j[l++];return 0==a?(o++,k>l&&2==o&&3==j[l]&&(l++,o=0)):o=0,a}function c(){return 0==m&&(n=b(),m=8),m--,n>>m&1}function d(a,b){for(var d=0;b>0;)d<<=1,d|=c(),b--;return d}function e(){for(var a=0;k>l&&0==c();)a++;return d(null,a)+((1<<a)-1)}function f(a,b){if(a){h.put("general_profile_space",d(i,2)),h.put("general_tier_flag",d(i,1)),h.put("general_profile_idc",d(i,5));for(var c=new Array(32),e=0;32>e;e++)c[e]=d(i,1);h.put("general_progressive_source_flag",d(i,1)),h.put("general_interlaced_source_flag",d(i,1)),h.put("general_non_packed_constraint_flag",d(i,1)),h.put("general_frame_only_constraint_flag",d(i,1));var f=h.get("general_profile_idc");4===f||c[4]||5===f||c[5]||6===f||c[6]||7===f||c[7]||8===f||c[8]||9===f||c[9]||10===f||c[10]?(h.put("general_max_12bit_constraint_flag",d(i,1)),h.put("general_max_10bit_constraint_flag",d(i,1)),h.put("general_max_8bit_constraint_flag",d(i,1)),h.put("general_max_422chroma_constraint_flag",d(i,1)),h.put("general_max_420chroma_constraint_flag",d(i,1)),h.put("general_max_monochrome_constraint_flag",d(i,1)),h.put("general_intra_constraint_flag",d(i,1)),h.put("general_one_picture_only_constraint_flag",d(i,1)),h.put("general_lower_bit_rate_constraint_flag",d(i,1)),5===f||c[5]||9===f||c[9]||10===f||c[10]?(h.put("general_max_14bit_constraint_flag",d(i,1)),h.put("general_reserved_zero_33bits",d(i,33))):h.put("general_reserved_zero_34bits",d(i,34))):h.put("general_reserved_zero_43bits",d(i,43)),f>=1&&5>=f||c[1]||c[2]||c[3]||c[4]||c[5]||c[9]?h.put("general_inbld_flag",d(i,1)):h.put("general_reserved_zero_bit",d(i,1))}h.put("general_level_idc",d(i,8));var g=new Array(b),j=new Array(b);for(q=0;b>q;q++)g[q]=d(i,1),j[q]=d(i,1);var k=new Array(8),l=new Array(b),m=new Array(b),n=new Array(b),o=[],p=new Array(b);if(b>0)for(var q=b;8>q;q++)k[q]=d(i,2);for(var q=0;b>q;q++){if(g[q]){m[q]=d(i,2),n[q]=d(i,1),l[q]=d(i,5);for(var e=0;32>e;e++)o[q][e]=d(i,1);h.put("sub_layer_progressive_source_flag",d(i,1)),h.put("sub_layer_interlaced_source_flag",d(i,1)),h.put("sub_layer_non_packed_constraint_flag",d(i,1)),h.put("sub_layer_frame_only_constraint_flag",d(i,1)),4===l[q]||o[q][4]||5===l[q]||o[q][5]||6===l[q]||o[q][6]||7===l[q]||o[q][7]||8===l[q]||o[q][8]||9===l[q]||o[q][9]||10===l[q]||o[q][10]?(h.put("sub_layer_max_12bit_constraint_flag",d(i,1)),h.put("sub_layer_max_10bit_constraint_flag",d(i,1)),h.put("sub_layer_max_8bit_constraint_flag",d(i,1)),h.put("sub_layer_max_422chroma_constraint_flag",d(i,1)),h.put("sub_layer_max_420chroma_constraint_flag",d(i,1)),h.put("sub_layer_max_monochrome_constraint_flag",d(i,1)),h.put("sub_layer_intra_constraint_flag",d(i,1)),h.put("sub_layer_one_picture_only_constraint_flag",d(i,1)),h.put("sub_layer_lower_bit_rate_constraint_flag",d(i,1)),5===l[q]||o[q][5]?(h.put("sub_layer_max_14bit_constraint_flag",d(i,1)),h.put("sub_layer_lower_bit_rate_constraint_flag",d(i,1)),p[q]=d(i,33)):p[q]=d(i,34)):h.put("sub_layer_reserved_zero_43bits",d(i,43)),l[q]>=1&&l[q]<=5||9==l[q]||o[1]||o[2]||o[3]||o[4]||o[5]||o[9]?h.put("sub_layer_inbld_flag",d(i,1)):h.put("sub_layer_reserved_zero_bit",d(i,1))}j[q]&&h.put("sub_layer_level_idc",d(i,8))}}var g=0,h=null,i=null,j=null,k=0,l=0,m=0,n=0,o=0;return a.prototype={parse:function(a){i=a,g=0,h.clear(),h.put("forbidden_zero_bit",d(i,1)),h.put("nal_unit_type",d(i,6)),h.put("nuh_layer_id",d(i,6)),h.put("nuh_temporal_id_plus1",d(i,3)),h.put("sps_video_parameter_set_id",d(i,4)),0===h.get("nuh_layer_id")?h.put("sps_max_sub_layers_minus1",d(i,3)):h.put("sps_ext_or_max_sub_layers_minus1",d(i,3));var b=0!==h.get("nuh_layer_id")&&7===h.get("sps_ext_or_max_sub_layers_minus1");return b||(h.put("sps_max_sub_layers_minus1",d(i,1)),f(1,h.get("sps_max_sub_layers_minus1"))),d(i,84),h.put("sps_seq_parameter_set_id",e(i,0)),b?(h.put("update_rep_format_flag",d(i,1)),h.get("update_rep_format_flag")&&h.put("sps_rep_format_idx",d(i,8))):(h.put("chroma_format_idc",e(i,0)),3===h.get("chroma_format_idc")&&h.put("separate_colour_plane_flag",d(i,1)),h.put("pic_width_in_luma_samples",e(i,0)),h.put(