implementation

This commit is contained in:
2026-05-12 21:22:55 +02:00
parent 22e61fcbd1
commit 86a437d12b
8 changed files with 12850 additions and 7508 deletions

View File

@ -1,6 +1,7 @@
#import "@preview/polylux:0.4.0": *
#import "@preview/cetz:0.5.0"
#import "@preview/cetz-plot:0.1.3": plot
#import "@preview/cetz:0.5.0": canvas
#set math.mat(delim: "[")
@ -26,10 +27,13 @@
// Footer
#v(1fr)
#context {
// let cur = counter(page).get().first()
// let tot = counter(page).final().first()
let cur = counter("logical-slide").get().first()
let tot = counter("logical-slide").final().first()
let fins = query(<fin>)
let tot = if fins.len() > 0 {
counter("logical-slide").at(fins.first().location()).first()
} else {
counter("logical-slide").final().first()
}
if cur > 1 {
block(width: 100%, fill: black, inset: (top: 0.2cm, bottom: 0.2cm, left: 1.5cm, right: 1.5cm))[
@ -37,7 +41,7 @@
#grid(
columns: (1.5fr, 2fr, 1fr, auto),
align: (left, center, center, right),
[#auteur #numero], [#titre], [#annee], [#(cur - 1) / #(tot - 1)],
[#auteur #numero], [#titre], [#annee], if cur <= tot [#(cur - 1) / #(tot - 1)] else [Annexe],
)
]
}
@ -801,8 +805,8 @@
let h_height = ny * cell_size
// Palette unifiée
let color_blue = blue
let color_orange = orange
let color_blue = orange
let color_orange = blue
let col_dot_base = gray.darken(30%)
// Définition des couleurs de fond (lighten)
@ -2846,8 +2850,12 @@
content("v" + str(i), text(size: 0.75em, fill: blue.darken(20%), weight: "bold")[$v_#i$])
let val = vals.at(i)
content(((-6.5, y_pos), 42%, (-2.0, 0)),
box(fill: col_vn_bg, stroke: 0.5pt + blue.lighten(60%), radius: 2pt, inset: 4pt)[
content(((-6.5, y_pos), 42%, (-2.0, 0)), box(
fill: col_vn_bg,
stroke: 0.5pt + blue.lighten(60%),
radius: 2pt,
inset: 4pt,
)[
#text(size: 0.65em, fill: black.lighten(10%), weight: "bold")[#val]
])
}
@ -2881,3 +2889,314 @@
#text(size: 0.8em, weight: "bold")[$m_(c arrow v_"cible") = -0.7$]
])
})
#let waterfall_plot(pts_uncoded, pts_bf) = {
cetz.canvas({
import cetz.draw
plot.plot(
size: (23, 14.5),
x-label: pad(top: 5cm)[],
y-label: [BER],
x-min: 0,
x-max: 8,
y-min: -9,
y-max: 0.2,
x-tick-step: 1,
y-tick-step: 1,
x-grid: true,
y-grid: true,
y-format: y => $10^(#int(y))$,
x-format: x => pad(top: 1cm)[#x],
legend: (2, 6),
legend-style: (
padding: 0.3,
stroke: gray.lighten(50%),
fill: white,
),
{
plot.annotate({
// for decade in range(-9, 0) {
// for minor in (2, 3, 4, 5, 6, 7, 8, 9) {
// let y_pos = decade + (calc.log(minor) / calc.log(10))
// if y_pos >= -9 and y_pos <= 0 {
// draw.line(
// (0, y_pos),
// (8, y_pos),
// stroke: (paint: gray.lighten(70%), thickness: 0.3pt),
// )
// }
// }
// }
draw.content((4, -10), text(size: 1.2em)[$E_b/N_0$ (dB)])
})
plot.add(
pts_uncoded,
label: [Signal non codé],
style: (stroke: (paint: orange, thickness: 2pt, dash: "dashed")),
mark: "+",
mark-style: (stroke: orange, size: 0.5),
)
plot.add(
pts_bf,
label: [Bit-Flipping],
style: (stroke: (paint: blue, thickness: 2.5pt)),
mark: "square",
mark-style: (stroke: blue, fill: white, size: 0.25),
)
},
)
})
}
#let convergence_plot(iters, syndrms) = {
let n = iters.len()
let max_s = 160.0
let W = 20.0
let H = 15.0
let bw = W / n
cetz.canvas({
import cetz.draw
for tick in (0, 50, 100, 150) {
let y = (tick / max_s) * H
draw.line((0, y), (W, y), stroke: 0.5pt + gray.lighten(60%))
draw.content((-0.8, y), text(size: 13pt)[#tick])
}
for i in range(n) {
let s = syndrms.at(i)
let bh = (s / max_s) * H
let x0 = i * bw
let col = if s == 0 { green.darken(20%) } else { blue }
draw.rect(
(x0, 0),
(x0 + bw * 0.8, bh),
fill: col.lighten(70%),
stroke: 1.2pt + col,
)
if calc.rem(i, 2) == 0 or i == n - 1 {
draw.content((x0 + bw * 0.4, -0.4), text(size: 13pt)[#i])
}
}
draw.line((0, 0), (W + 0.8, 0), stroke: 2pt, mark: (end: "stealth"))
draw.line((0, 0), (0, H + 0.8), stroke: 2pt, mark: (end: "stealth"))
draw.content((W / 2, -1), text(size: 19pt, weight: "bold")[Itérations])
draw.content((-2.2, H / 2), angle: 90deg, text(size: 19pt, weight: "bold")[Syndromes])
})
}
#let waterfall_plot(pts_uncoded, pts_bf) = {
cetz.canvas({
import cetz.draw: *
plot.plot(
size: (22, 15),
x-label: none,
y-label: none,
x-min: 0,
x-max: 10,
y-min: -9,
y-max: 0.2,
x-tick-step: 1,
y-tick-step: 1,
x-grid: true,
y-grid: true,
style: (
axes: (
bottom: (tick: (label: (offset: 0.2))), // Chiffres plus proches de l'axe
left: (tick: (label: (offset: 0.2))),
),
),
y-format: y => $10^(#int(y))$,
x-format: x => [#x],
legend: (14.4, 12.9),
legend-style: (padding: 0.3, stroke: gray.lighten(50%), fill: white),
{
plot.annotate({
// for decade in range(-9, 0) {
// for minor in (2, 3, 4, 5, 6, 7, 8, 9) {
// let y_pos = decade + (calc.log(minor) / calc.log(10))
// if y_pos >= -9 and y_pos <= 0 {
// line((0, y_pos), (8, y_pos), stroke: (paint: gray.lighten(60%), thickness: 0.3pt))
// }
// }
// }
content((4, -9.9), text(size: 1.3em)[$E_b/N_0$ (dB)])
content((-1, -4.5), angle: 90deg, text(size: 1.3em)[BER])
})
plot.add(
pts_uncoded,
label: [Signal non codé],
style: (stroke: (paint: orange, thickness: 2pt, dash: "dashed")),
mark: "+",
mark-style: (stroke: orange, size: 0.5),
)
plot.add(
pts_bf,
label: [Bit-Flipping LDPC],
style: (stroke: (paint: blue, thickness: 2.5pt)),
mark: "square",
mark-style: (stroke: blue, fill: white, size: 0.25),
)
},
)
})
}
#let simulation_image_flow(img_orig, img_noisy, img_r05, img_r66, img_r75, img_w: 150pt, gap_top: 3.0, gap_bot: 4.0) = {
cetz.canvas({
import cetz.draw: *
let w_unit = img_w / 1cm
let y_top = 5.0
let y_bot = -6.0
let x_side = (w_unit + gap_top) / 2
let x_res = w_unit + gap_bot
// --- LIGNE 1 : ÉMISSION ET BRUIT (Texte collé en haut) ---
content(
(-x_side, y_top),
[
#set align(center)
#set par(leading: 0pt)
#set text(bottom-edge: "baseline") // Supprime l'espace sous les lettres
#text(weight: "bold", size: 1.3em)[Originale]
#v(-0.6cm)
#box(width: img_w, stroke: 2pt + black, radius: 4pt, inset: 0pt, img_orig)
],
name: "orig",
)
content(
(x_side, y_top),
[
#set align(center)
#set par(leading: 0pt)
#set text(bottom-edge: "baseline")
#text(weight: "bold", size: 1.3em, fill: red)[Reçue (Bruité)]
#v(-0.6cm)
#box(width: img_w, stroke: 2pt + red, radius: 4pt, inset: 0pt, img_noisy)
],
name: "noisy",
)
// --- FLÈCHE CANAL (Ajustée pour le nouveau centre de gravité) ---
let y_img_center = y_top - 1.4
line(
(-x_side + w_unit / 2, y_img_center),
(x_side - w_unit / 2, y_img_center),
stroke: 4pt + gray,
mark: (end: "stealth", fill: gray, size: 0.5),
)
content((0, y_img_center + 0.8), text(size: 1.1em, fill: gray.darken(40%), style: "italic")[AWGN (2.3 dB)])
// --- LIGNE 2 : COMPARAISON DES RENDEMENTS (Texte collé en bas) ---
let targets = (
(pos: (-x_res, y_bot), img: img_r05, rate: [$R = 1/2$], col: green.darken(20%), name: "r1"),
(pos: (0, y_bot), img: img_r66, rate: [$R = 2/3$], col: orange, name: "r2"),
(pos: (x_res, y_bot), img: img_r75, rate: [$R = 3/4$], col: red, name: "r3"),
)
for t in targets {
content(
t.pos,
[
#set align(center)
#set par(leading: 0pt)
#set text(top-edge: "baseline") // Supprime l'espace au-dessus des lettres
#box(width: img_w, stroke: 2.5pt + t.col, radius: 4pt, inset: 0pt, t.img)
#v(-0.6cm)
#text(weight: "bold", size: 1.5em, fill: t.col)[#t.rate]
],
name: t.name,
)
}
})
}
#let comparison_waterfall_plot(pts_unc, pts_bf, pts_sp, pts_ms) = {
cetz.canvas({
import cetz.draw: *
plot.plot(
size: (21, 15),
x-label: none,
y-label: none,
x-min: 0,
x-max: 11,
y-min: -8,
y-max: 0.2,
x-tick-step: 1,
y-tick-step: 1,
x-grid: true,
y-grid: true,
style: (
axes: (
bottom: (tick: (label: (offset: 0.2))),
left: (tick: (label: (offset: 0.2))),
),
),
y-format: y => $10^(#int(y))$,
x-format: x => [#x],
legend: (13.2, 11.4),
legend-style: (padding: 0.3, stroke: gray.lighten(50%), fill: white),
{
plot.annotate({
// Grille logarithmique étendue jusqu'à x=11
// for decade in range(-8, 0) {
// for minor in (2, 3, 4, 5, 6, 7, 8, 9) {
// let y_pos = decade + (calc.log(minor) / calc.log(10))
// if y_pos >= -8 and y_pos <= 0 {
// line((0, y_pos), (11, y_pos), stroke: (paint: gray.lighten(75%), thickness: 0.3pt))
// }
// }
// }
// Label X centré sur 11 unités (environ 5.5)
content((5.5, -8.7), text(size: 1.3em)[$E_b/N_0$ (dB)])
// Label Y
content((-1.2, -4.0), angle: 90deg, text(size: 1.3em)[BER])
})
plot.add(
pts_unc,
label: [Signal non codé],
style: (stroke: (paint: orange, thickness: 2pt, dash: "dashed")),
mark: "+",
mark-style: (stroke: orange, size: 1),
)
plot.add(
pts_bf,
label: [Bit-Flipping (Hard)],
style: (stroke: (paint: red, thickness: 2pt)),
mark: "x",
mark-style: (stroke: red, size: 1),
)
plot.add(
pts_ms,
label: [Min-Sum (Soft)],
style: (stroke: (paint: green.darken(20%), thickness: 2pt)),
mark: "triangle",
mark-style: (stroke: green.darken(20%), fill: white, size: 0.3),
)
plot.add(
pts_sp,
label: [Sum-Product (Soft)],
style: (stroke: (paint: blue, thickness: 2pt)),
mark: "square",
mark-style: (stroke: blue, fill: white, size: 1),
)
},
)
})
}

19866
main.pdf

File diff suppressed because it is too large Load Diff

137
main.typ
View File

@ -789,6 +789,11 @@
]
]
#myslide("Méthode de génération de H")[
- Gallager
- Mackay
- Progressive Edge-growth
]
#myslide("Encodage LDPC : Calcul de G")[
#set text(size: 18pt)
@ -932,17 +937,62 @@
]
]
#myslide("Exemple implementation Bit-Flipping rust")[
ex + canal d'etude bruit AWGN avec ce qu'il se passe dans les radio / cable etc + tension
#let log10(x) = if x < 1e-9 { -9.0 } else { calc.log(x) / calc.log(10) }
#let raw_waterfall = (
(0.0, 0.158461, 0.281269),
(1.0, 0.130748, 0.247257),
(2.0, 0.104310, 0.205882),
(3.0, 0.079301, 0.151808),
(4.0, 0.056395, 0.063852),
(4.5, 0.046493, 0.023414),
(5.0, 0.037572, 0.004078),
(5.5, 0.029673, 0.000470),
(6.0, 0.022973, 0.000045),
(7.0, 0.012519, 0.000002),
(8.0, 0.006030, 0.000000001),
// On lisse la fin pour éviter l'effet "escalier"
(8.5, 0.004200, 0.0),
(9.0, 0.002800, 0.0),
(9.5, 0.001800, 0.0),
(10.0, 0.001100, 0.0),
)
#let pts_unc = raw_waterfall.map(r => (r.at(0), log10(r.at(1))))
#let pts_bf = raw_waterfall.map(r => (r.at(0), log10(r.at(2))))
// Données Convergence
#let iters = range(25)
#let syndrms = (135, 66, 60, 61, 31, 24, 21, 19, 19, 16, 15, 155, 45, 35, 31, 19, 16, 13, 10, 9, 6, 5, 4, 3, 0)
#myslide([Waterfall : LDPC (3, 6) $n = 1296, space k = 648, space R = 1/2$])[
#align(center)[#waterfall_plot(pts_unc, pts_bf)]
// #place(dx: 140pt, dy: -140pt)[
// #align(center)[
// // Affichage des paramètres du code
// #scale(110%)[
// #rect(fill: blue.lighten(95%), stroke: 0.5pt + blue.lighten(80%), radius: 4pt, inset: 10pt)[
// #set text(size: 18pt)
// *LDPC $(3, 6)$* #h(1cm)
// $n = 1296$, $k = 648$ #h(1cm)
// Rendement $R = 1/2$
// ]]
// ]
// ]
]
#myslide([Résultats : Convergence syndrome])[
#align(center)[#convergence_plot(iters, syndrms)]
]
#myslide("Bit-Flipping : Analyse")[
// TODO PARLER DU GIRTH 4 => MAUVAIS
#set text(size: 17pt)
#place(dy: 4.5cm)[
#definition(titre: "Avantages", accent: green.darken(10%))[
#set text(size: 0.88em)
- *Complexité* : simples XOR et compteurs $cal(O)(n)$ par itération
- *Complexité* : simples XOR et compteurs -- $cal(O)(n)$ par itération
// - *Matériel* : idéal FPGA/ASIC, massivement parallélisable
// - *Simplicité* : inventé par Gallager (1962)
]
@ -962,12 +1012,13 @@
// ]
]
]
]
#myslide("Décodage Soft : Le LLR")[
#set text(size: 17pt)
#definition(titre: "Signal", accent: blue.darken(10%))[
On reçoit une valeur $y_i$ (ex: $+4.5$V ou $-0.2$V). Le LLR transforme cette mesure physique en une valeur statistique sans unité.
On reçoit une valeur $y_i$ (ex: $+4.5$V ou $-0.2$V).
]
#v(0.6em)
@ -978,7 +1029,7 @@
$
]
#v(0.6em)
#v(1.3em)
#align(center)[
#scale(125%)[#schema_llr_droite()]
@ -1121,8 +1172,21 @@
]
]
#myslide("Implementation rust")[
#myslide([Transmission d'image])[
#place(center, dy: -2cm)[
#scale(85%)[
#simulation_image_flow(
image("src/origine.png", width: 100%),
image("src/noisy.png", width: 100%),
image("src/decoded_R05_1-2.png", width: 100%),
image("src/decoded_R66_2-3.png", width: 100%),
image("src/decoded_R75_3-4.png", width: 100%),
img_w: 230pt,
gap_top: 7.0,
gap_bot: 2.0,
)
]
]
]
#myslide("Min-Sum")[
@ -1155,14 +1219,53 @@
]
]
#myslide("Test réel")[
Irl hackrf, test de diff de debit avec des paquets
#let log10(x) = if x <= 1e-9 { -8.0 } else { calc.log(x) / calc.log(10) }
#let raw_data = (
(0.00, 1.2397e-1, 4.9986e-1, 1.1404e-1, 1.2470e-1),
(0.50, 1.1057e-1, 4.9993e-1, 9.5550e-2, 1.0485e-1),
(1.00, 9.7682e-2, 4.9978e-1, 7.5017e-2, 8.2555e-2),
(1.50, 8.4916e-2, 4.9993e-1, 4.6412e-2, 5.1824e-2),
(2.00, 7.3000e-2, 5.0008e-1, 1.1640e-2, 1.3790e-2),
(2.50, 6.1705e-2, 4.9987e-1, 4.0818e-4, 5.3380e-4),
(3.00, 5.1501e-2, 5.0020e-1, 4.8765e-5, 8.0247e-6),
(3.50, 4.1921e-2, 5.0005e-1, 0, 0),
(4.00, 3.3645e-2, 4.9959e-1, 0, 0),
(5.00, 1.9973e-2, 4.9890e-1, 0, 0),
(6.00, 1.0584e-2, 3.8048e-1, 0, 0),
(7.00, 4.8994e-3, 4.0660e-2, 0, 0),
(8.00, 1.8194e-3, 3.8519e-4, 0, 0),
(9.00, 5.6235e-4, 8.1790e-6, 0, 0),
(10.00, 1.3133e-4, 6.1728e-7, 0, 0),
(11.00, 2.5154e-5, 0, 0, 0),
)
#let pts_unc = raw_data.map(d => (d.at(0), log10(d.at(1))))
#let pts_bf = raw_data.map(d => (d.at(0), log10(d.at(2))))
#let pts_sp = raw_data.map(d => (d.at(0), log10(d.at(3))))
#let pts_ms = raw_data.map(d => (d.at(0), log10(d.at(4))))
#myslide([Waterfall : LDPC (3, 9) $n = 1296, space k = 864, space R = 2/3$])[
#align(center)[
// #rect(fill: gray.lighten(95%), radius: 4pt, inset: 8pt)[
// #set text(size: 16pt)
// Comparaison BER : *Bit-Flipping* (Décision dure) vs *Soft-Decisions* (SP & MS)
// ]
#comparison_waterfall_plot(pts_unc, pts_bf, pts_sp, pts_ms)
]
]
#myslide("Image")[
Test de transmission d'image avec différent ldpc non opti et opti (le H)
#myslide("QC-LDPC")[
]
#myslide("Test réel")[
Transmission hackrf, test de diff de debit avec paquets
Test de transmission d'image avec différent ldpc non opti et opti (H diff etc)
]
#[]<fin>
#myslide("Annexe")[
#align(center + horizon)[
Annexe
@ -1176,6 +1279,10 @@
Poser les notations algebriques etc...
]
#myslide("Définition du BER et SFR")[
]
#myslide("Decodage par maximum de vraisemblance")[
Expliquer, quelle distance ? etc
]
@ -1187,3 +1294,11 @@
#myslide("Maths deriere Belief Propagation")[
]
#myslide("AWGN")[
]
#myslide("PEG")[
]

BIN
src/decoded_R05_1-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
src/decoded_R66_2-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

BIN
src/decoded_R75_3-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

BIN
src/noisy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

BIN
src/origine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB