I'm trying to generate 29400 ($8C4^2 * 6$) indices for each one of the cube states in G2.
$8C4^2$ = 4900 is for solving the corner and edge pieces (forming the 2 corner tetrads and getting the remaining 8 edges into their slices). Then, because of 90-degree left and right face turns, an extra factor of 2 is added due to states with uneven parity. To that, an extra factor of 3 is added which is explained here in a different question which gives all 29400 states.
I've only managed to generate $8C4^2 * 2$ = 9800 states so far (missing an extra factor of 3)
Once the corner tetrads are formed, it's possible to calculate the factor of 3: it's explained here, and the gist of it is that if for example the two tetrads are split to an even and an uneven tetrad like this:
(0,2,4,6) (1,3,5,7) then for every permutation of the even tetrad, the uneven tetrad will be in one of 4! = 24 permutations (and vice versa). After solving 5 corners (e.g the entire even tetrad and the first corner in the uneven tetrad) the 3 remaining pieces can be in any one of the 3! = 6 permutations which gives the 2 * 3 = 6 factor (2 for parity).
This works, but only if the 2 tetrads are formed, so it's only relevant to $4!^2$ = 576 states (or 1 of the 8C4 states). The additional factor of 3 in G2 also applies to cube states where the tetrads aren't formed yet.
One work-around is splitting the two corner tetrads into 4 pairs instead, which gives 8C4 * (8C2 * 6C2 * 4C2 * 2C2) * 2 = 352800 unique states instead of 29400, which is less than 8C4 * 8! * 2 but still more than $8C4^2$ * 6.
Is it possible to assign each one of the 29400 cube states in G2 a unique index? I haven't found any implementation of the algorithm that does it yet.
The issue described in the comments was that the corner permutation had a relation of
perm[position] = piece_ind instead of
perm[piece_ind] = position