]> git.sesse.net Git - x264/blobdiff - common/set.h
osx: Add -D_DARWIN_C_SOURCE to CFLAGS
[x264] / common / set.h
index 9a1bb7dd2d434ae1e006fc63c9fd630e5df3281b..69ec67c2f3742bf5cd94c71a1c3c048d25dff178 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
- * set.h: h264 encoder
+ * set.h: quantization init
  *****************************************************************************
- * Copyright (C) 2003 Laurent Aimar
- * $Id: set.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $
+ * Copyright (C) 2003-2016 x264 project
  *
- * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ * Authors: Loren Merritt <lorenm@u.washington.edu>
+ *          Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
  *****************************************************************************/
 
-#ifndef _SET_H
-#define _SET_H 1
+#ifndef X264_SET_H
+#define X264_SET_H
 
 enum profile_e
 {
     PROFILE_BASELINE = 66,
     PROFILE_MAIN     = 77,
-    PROFILE_EXTENTED = 88,
     PROFILE_HIGH    = 100,
     PROFILE_HIGH10  = 110,
     PROFILE_HIGH422 = 122,
-    PROFILE_HIGH444 = 144
+    PROFILE_HIGH444_PREDICTIVE = 244,
+};
+
+enum chroma_format_e
+{
+    CHROMA_400 = 0,
+    CHROMA_420 = 1,
+    CHROMA_422 = 2,
+    CHROMA_444 = 3,
 };
 
 enum cqm4_e
@@ -45,7 +55,9 @@ enum cqm4_e
 enum cqm8_e
 {
     CQM_8IY = 0,
-    CQM_8PY = 1
+    CQM_8PY = 1,
+    CQM_8IC = 2,
+    CQM_8PC = 3,
 };
 
 typedef struct
@@ -58,18 +70,13 @@ typedef struct
     int b_constraint_set0;
     int b_constraint_set1;
     int b_constraint_set2;
+    int b_constraint_set3;
 
     int i_log2_max_frame_num;
 
     int i_poc_type;
     /* poc 0 */
     int i_log2_max_poc_lsb;
-    /* poc 1 */
-    int b_delta_pic_order_always_zero;
-    int i_offset_for_non_ref_pic;
-    int i_offset_for_top_to_bottom_field;
-    int i_num_ref_frames_in_poc_cycle;
-    int i_offset_for_ref_frame[256];
 
     int i_num_ref_frames;
     int b_gaps_in_frame_num_value_allowed;
@@ -95,11 +102,47 @@ typedef struct
         int i_sar_width;
         int i_sar_height;
 
+        int b_overscan_info_present;
+        int b_overscan_info;
+
+        int b_signal_type_present;
+        int i_vidformat;
+        int b_fullrange;
+        int b_color_description_present;
+        int i_colorprim;
+        int i_transfer;
+        int i_colmatrix;
+
+        int b_chroma_loc_info_present;
+        int i_chroma_loc_top;
+        int i_chroma_loc_bottom;
+
         int b_timing_info_present;
-        int i_num_units_in_tick;
-        int i_time_scale;
+        uint32_t i_num_units_in_tick;
+        uint32_t i_time_scale;
         int b_fixed_frame_rate;
 
+        int b_nal_hrd_parameters_present;
+        int b_vcl_hrd_parameters_present;
+
+        struct
+        {
+            int i_cpb_cnt;
+            int i_bit_rate_scale;
+            int i_cpb_size_scale;
+            int i_bit_rate_value;
+            int i_cpb_size_value;
+            int i_bit_rate_unscaled;
+            int i_cpb_size_unscaled;
+            int b_cbr_hrd;
+
+            int i_initial_cpb_removal_delay_length;
+            int i_cpb_removal_delay_length;
+            int i_dpb_output_delay_length;
+            int i_time_offset_length;
+        } hrd;
+
+        int b_pic_struct_present;
         int b_bitstream_restriction;
         int b_motion_vectors_over_pic_boundaries;
         int i_max_bytes_per_pic_denom;
@@ -113,6 +156,7 @@ typedef struct
     } vui;
 
     int b_qpprime_y_zero_transform_bypass;
+    int i_chroma_format_idc;
 
 } x264_sps_t;
 
@@ -126,25 +170,8 @@ typedef struct
     int b_pic_order;
     int i_num_slice_groups;
 
-#if 0
-    /* FIXME: if this stuff is ever needed, move SPS/PPS from x264_t
-     * to the heap, to avoid excessive memcpy'ing with threads. */
-    int i_slice_group_map_type;
-    /* i_slice_group_map_type == 0 */
-    int i_run_length[256];      /* FIXME */
-    /* i_slice_group_map_type == 2 */
-    int i_top_left[256];        /* FIXME */
-    int i_bottom_right[256];    /* FIXME */
-    /* i_slice_group_map_type == 3, 4, 5 */
-    int b_slice_group_change_direction;
-    int i_slice_group_change_rate;
-    /* i_slice_group_map_type == 6 */
-    int i_pic_size_in_map_units;
-    int i_slice_group_id[256];  /* FIXME */
-#endif
-
-    int i_num_ref_idx_l0_active;
-    int i_num_ref_idx_l1_active;
+    int i_num_ref_idx_l0_default_active;
+    int i_num_ref_idx_l1_default_active;
 
     int b_weighted_pred;
     int b_weighted_bipred;
@@ -161,7 +188,7 @@ typedef struct
     int b_transform_8x8_mode;
 
     int i_cqm_preset;
-    const uint8_t *scaling_list[6]; /* could be 8, but we don't allow separate Cb/Cr lists */
+    const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */
 
 } x264_pps_t;
 
@@ -213,8 +240,108 @@ static const uint8_t x264_cqm_flat16[64] =
     16,16,16,16,16,16,16,16,
     16,16,16,16,16,16,16,16
 };
+static const uint8_t * const x264_cqm_jvt[8] =
+{
+    x264_cqm_jvt4i, x264_cqm_jvt4p,
+    x264_cqm_jvt4i, x264_cqm_jvt4p,
+    x264_cqm_jvt8i, x264_cqm_jvt8p,
+    x264_cqm_jvt8i, x264_cqm_jvt8p
+};
+
+// 1080i25_avci50, 1080p25_avci50
+static const uint8_t x264_cqm_avci50_4ic[16] =
+{
+    16,22,28,40,
+    22,28,40,44,
+    28,40,44,48,
+    40,44,48,60
+};
+
+//  1080i25_avci50,
+static const uint8_t x264_cqm_avci50_1080i_8iy[64] =
+{
+    16,18,19,21,27,33,81,87,
+    18,19,21,24,30,33,81,87,
+    19,21,24,27,30,78,84,90,
+    21,24,27,30,33,78,84,90,
+    24,27,30,33,78,81,84,90,
+    24,27,30,33,78,81,84,93,
+    27,30,33,78,78,81,87,93,
+    30,33,33,78,81,84,87,96
+};
+
+//  1080p25_avci50, 720p25_avci50, 720p50_avci50
+static const uint8_t x264_cqm_avci50_p_8iy[64] =
+{
+    16,18,19,21,24,27,30,33,
+    18,19,21,24,27,30,33,78,
+    19,21,24,27,30,33,78,81,
+    21,24,27,30,33,78,81,84,
+    24,27,30,33,78,81,84,87,
+    27,30,33,78,81,84,87,90,
+    30,33,78,81,84,87,90,93,
+    33,78,81,84,87,90,93,96
+};
+
+//  1080i25_avci100, 1080p25_avci100
+static const uint8_t x264_cqm_avci100_1080_4ic[16] =
+{
+    16,20,26,32,
+    20,26,32,38,
+    26,32,38,44,
+    32,38,44,50
+};
+
+// 720p25_avci100, 720p50_avci100
+static const uint8_t x264_cqm_avci100_720p_4ic[16] =
+{
+    16,21,27,34,
+    21,27,34,41,
+    27,34,41,46,
+    34,41,46,54
+};
+
+//  1080i25_avci100,
+static const uint8_t x264_cqm_avci100_1080i_8iy[64] =
+{
+    16,19,20,23,24,26,32,42,
+    18,19,22,24,26,32,36,42,
+    18,20,23,24,26,32,36,63,
+    19,20,23,26,32,36,42,63,
+    20,22,24,26,32,36,59,63,
+    22,23,24,26,32,36,59,68,
+    22,23,24,26,32,42,59,68,
+    22,23,24,26,36,42,59,72
+};
+
+// 1080p25_avci100,
+static const uint8_t x264_cqm_avci100_1080p_8iy[64] =
+{
+    16,18,19,20,22,23,24,26,
+    18,19,20,22,23,24,26,32,
+    19,20,22,23,24,26,32,36,
+    20,22,23,24,26,32,36,42,
+    22,23,24,26,32,36,42,59,
+    23,24,26,32,36,42,59,63,
+    24,26,32,36,42,59,63,68,
+    26,32,36,42,59,63,68,72
+};
+
+// 720p25_avci100, 720p50_avci100
+static const uint8_t x264_cqm_avci100_720p_8iy[64] =
+{
+    16,18,19,21,22,24,26,32,
+    18,19,19,21,22,24,26,32,
+    19,19,21,22,22,24,26,32,
+    21,21,22,22,23,24,26,34,
+    22,22,22,23,24,25,26,34,
+    24,24,24,24,25,26,34,36,
+    26,26,26,26,26,34,36,38,
+    32,32,32,34,34,36,38,42
+};
 
-void x264_cqm_init( x264_t *h );
+int  x264_cqm_init( x264_t *h );
+void x264_cqm_delete( x264_t *h );
 int  x264_cqm_parse_file( x264_t *h, const char *filename );
 
 #endif