rust-av / grav1synth

Grain Synth analyzer and editor for AV1 files
MIT License
52 stars 4 forks source link

Arbitrary end time value for final segment of grain table file #14

Closed Ironclad17 closed 8 months ago

Ironclad17 commented 8 months ago

To add multiprocessing, I performed grav1synth diff on multiple clips made from a single video. Specifically I made source and denoised source using av1an and I'm performing the diff operation on the chunks generated before concatenation, and I was hoping to combine the generated tables to apply to the concatenated file. I was hoping I could offset the start and end times of each segment based on the timestamps from the previous grain table file, but the last segment end time of each grain table file is always "9223372036854775807". Here are the first 3 grain table files: 1st Table

filmgrn1
E 0 9223372036854775807 1 10956 1
    p 3 8 0 11 0 1 128 192 256 128 192 256
    sY 5  0 38 107 38 148 36 188 32 255 31
    sCb 7 0 17 54 17 107 15 134 14 188 17 215 17 255 17
    sCr 5 0 20 54 20 148 17 228 19 255 19
    cY 4 -1 2 11 3 -3 6 5 5 -18 -3 -3 -1 -2 0 -44 21 86 24 7 3 1 58 70
    cCb 3 0 -4 13 -4 -8 2 7 -6 -23 21 4 -3 -2 -9 -45 9 87 23 18 3 -2 81 80 7
    cCr 5 -2 -3 13 -4 -6 3 2 -7 -19 15 8 0 -4 -7 -36 7 77 24 15 4 7 75 71 10

2nd Table

filmgrn1
E 0 417083 1 10956 1
    p 3 8 0 11 0 1 128 192 256 128 192 256
    sY 8  0 62 54 62 107 60 134 56 188 47 201 45 215 44 255 41
    sCb 3 0 18 148 19 255 17
    sCr 6 0 23 188 22 215 18 228 15 242 15 255 15
    cY 8 -1 6 -1 4 -6 9 -4 10 -15 6 -8 7 -6 7 -26 22 58 22 4 14 -3 43 58
    cCb 2 2 -9 22 0 -8 -2 9 -3 -19 24 -2 -3 -9 -6 -48 -6 80 20 21 15 -5 64 102 14
    cCr 2 -1 -9 18 0 -7 3 -2 4 0 23 -8 0 -6 4 -39 -4 66 20 18 12 -2 51 89 14
E 417083 9223372036854775807 1 0 1
    p 3 8 0 11 0 1 128 192 256 128 192 256
    sY 3  0 37 107 36 255 34
    sCb 4 0 24 107 24 174 23 255 21
    sCr 5 0 22 121 21 188 20 242 16 255 16
    cY 0 0 3 10 1 -3 3 5 4 -19 -13 -4 -4 -1 -1 -40 26 93 27 17 8 -5 54 67
    cCb 3 0 -1 8 -4 -8 -2 4 -9 -17 13 10 -2 -1 -11 -37 36 84 20 21 8 -3 84 42 9
    cCr 2 0 -1 9 -5 -8 1 4 -7 -16 12 6 -1 0 -9 -39 33 89 23 19 7 -3 80 44 5

3rd Table

filmgrn1
E 0 417083 1 10956 1
    p 3 8 0 11 0 1 128 192 256 128 192 256
    sY 7  0 72 94 71 121 70 174 61 215 49 242 47 255 47
    sCb 7 0 42 54 42 81 39 121 29 134 28 201 17 255 19
    sCr 8 0 35 54 35 81 33 121 26 161 23 215 16 228 14 255 14
    cY 8 1 9 1 9 -2 11 -4 16 -8 0 -4 15 -4 15 -11 12 52 8 0 12 1 27 45
    cCb 0 -6 -3 19 5 -4 1 -2 16 -13 -6 -5 4 2 10 -33 -13 105 10 5 5 0 38 100 6
    cCr 3 -7 2 13 2 -4 -1 -5 14 -7 -1 3 0 2 1 -26 -9 102 15 10 1 6 38 83 3
E 417083 9223372036854775807 1 0 1
    p 3 8 0 11 0 1 128 192 256 128 192 256
    sY 7  0 51 54 51 81 49 121 43 161 39 188 34 255 33
    sCb 7 0 37 54 37 81 34 121 26 201 19 215 19 255 19
    sCr 9 0 34 54 34 81 32 121 26 134 25 174 22 201 17 242 15 255 15
    cY 4 0 2 8 2 -3 6 6 8 -18 -11 -6 -1 -1 3 -44 18 94 28 8 3 -6 49 84
    cCb 2 -3 -3 13 -1 -6 2 4 7 -13 3 0 1 1 0 -42 0 96 18 10 6 -3 59 89 2
    cCr 1 -3 -1 11 1 -3 -1 1 5 -11 4 3 0 2 -2 -34 4 93 15 11 7 0 55 85 2

As is I have no way of telling when the last segment of each file should end and the next segment in the next file should start.

Ironclad17 commented 8 months ago

I instead opted to apply the grain tables to the av1an chunks before concatenation instead for simplicity.