Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Tecnologias-multimedia/intercom
Browse files Browse the repository at this point in the history
  • Loading branch information
vicente-gonzalez-ruiz committed Jan 6, 2021
2 parents 56973d4 + dba767f commit 46371b1
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 75 deletions.
89 changes: 42 additions & 47 deletions 2021/G1/readme_MLTN10.ipynb
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.8.5 64-bit",
"metadata": {
"interpreter": {
"hash": "d568976d192056dbc40b4f20450c40693209c689431c06ee8cdbba3e96c4577d"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Milestone 10\n",
"## Control de la tasa de bits mediante cuantización\n",
"\n",
"Como especifica el [enunciado](https://tecnologias-multimedia.github.io/study_guide/quantization/), usaremos el cuantificador estático de zona muerta, en nuestro código quedará,\n",
"### - Para cuantizar:"
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "code",
Expand All @@ -48,11 +22,11 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### - Para decuantizar:"
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "code",
Expand All @@ -65,6 +39,8 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Lo importante\n",
"Lo que se intenta es enviar el mismo número de paquetes aunque haya una mala conexión, comprimiendo los paquetes si es necesario.\n",
Expand All @@ -76,18 +52,16 @@
"- chunks/s >= 43 -> El ancho de banda ha mejorado, disminuimos `quantization_step` un 20%\n",
"- chunks/s <= 37 -> El ancho de banda ha empeorado, aumentamos `quantization_step` un 20%\n",
"- chunks/s entre 38 y 42 -> El ancho de banda no ha variado mucho, no se cambiará `quantization_step`"
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"> quantization step: 120\n"
]
Expand All @@ -106,31 +80,52 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"En el ejemplo anterior, se aumenta el `quantization_step`, disminuyendo el número de valores diferentes para la cuantización a costa de reducir la calidad del sonido.\n",
"\n",
"\n",
"\n",
"- Obtenemos los chunks/s a partir de los paquetes recibidos, no lo hacemos con los enviados ya que con UDP, no podemos saber si los paquetes han sido realmente enviados."
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Adicionalmente, hemos añadido otro hilo para mostrar los stats por pantalla, al ser una implementación tan diferente la que nos facilita el profesor a la nuestra, lo hemos hecho de cero con los datos que hemos considerado relevantes."
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Demostración\n",
"\n",
"[![Demostración](https://i.imgur.com/i79NxCL.png)](https://vimeo.com/user128820769/review/488828352/79bbb6f0ce)\n"
],
"cell_type": "markdown",
"metadata": {}
]
}
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
4 changes: 2 additions & 2 deletions docs/2-hours_seminar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@
"source": [
"N = 512\n",
"levels = 4\n",
"#wavelet_name = \"haar\"\n",
"wavelet_name = \"db5\"\n",
"wavelet_name = \"haar\"\n",
"#wavelet_name = \"db5\"\n",
"#wavelet_name = \"db20\"\n",
"#wavelet_name = \"bior2.2\"\n",
"#wavelet_name = \"rbio2.2\"\n",
Expand Down
70 changes: 44 additions & 26 deletions docs/DWT.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -67,12 +67,12 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#wavelet_name = \"haar\"\n",
"wavelet_name = \"db5\"\n",
"wavelet_name = \"haar\"\n",
"#wavelet_name = \"db5\"\n",
"#wavelet_name = \"db20\"\n",
"#wavelet_name = \"bior2.2\"\n",
"#wavelet_name = \"rbio2.2\"\n",
Expand All @@ -89,7 +89,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -99,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -125,28 +125,46 @@
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7831edb30ffe448eb836d81d743d448f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='i', max=511), Output()), _dom_classes=('widget-interact'…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"interact(spectrum, i=widgets.IntSlider(min=0, max=N-1, step=1, value=0));"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Testing orthogonality of the (synthesis) basis"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def get_basis(i):\n",
" zeros = np.zeros(N)\n",
" decomposition = pywt.wavedec(zeros, wavelet=wavelet, level=levels, mode=\"per\")\n",
" coefficients, slices = pywt.coeffs_to_array(decomposition)\n",
" coefficients[i] = 1\n",
" decomposition = pywt.array_to_coeffs(coefficients, slices, output_format=\"wavedec\")\n",
" samples = pywt.waverec(decomposition, wavelet=wavelet, mode=\"per\")\n",
" return samples\n",
"\n",
"print(\"Inner product between different basis fuctions\")\n",
"for i in range(N):\n",
" print(np.inner(get_basis(i), get_basis((i+1)%N)))\n",
" \n",
"print(\"Inner product between the same basis fuction\")\n",
"for i in range(N):\n",
" print(np.inner(get_basis(i), get_basis(i)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 46371b1

Please sign in to comment.