SlideShare a Scribd company logo
VIDEO CODEC USING MATLAB
Our online Tutors are available 24*7 to provide Help with Video Codec Homework/Assignment or a
long term Graduate/Undergraduate Video Codec Project. Our Tutors being experienced and proficient
in Video Codec ensure to provide high quality Video Codec Homework Help. Upload your Video
Codec Assignment at ‘Submit Your Assignment’ button or email it to info@assignmentpedia.com. You
can use our ‘Live Chat’ option to schedule an Online Tutoring session with our Video Codec Tutors.
H.264 BASELINE CODEC V2
This sample assignment shows slightly updated version 2 of H.264 baseline codec.
dec_cavlc(bits,nL,nU)
function [data,i] = dec_cavlc(bits,nL,nU)
%% CAVLC Decoder
% By A. A. Muhit
% It takes bitstream and decodes 4x4 block of data
% Load the table containing all the tables
% load table.mat;
global Table_coeff0 Table_coeff1 Table_coeff2 Table_coeff3
global Table_run Table_zeros
% test data
% bits =
'00000000001000101000000011001011111001011101010000000010000111111111111111001110';
% nL = 0;
% nU = 0;
% find n parameter (context adaptive)
if (nL>0)&(nU>0)
n = (nL + nU)/2;
elseif (nL>0)|(nU>0)
n = nL + nU;
else
n = 0;
end
% Coeff_token mapping
% Rows are the total coefficient(0-16) and columns are the trailing ones(0-3)
% TABLE_COEFF0,1,2,3 ARE STORED IN TABLE.MAT OR CAVLC_TABLES.M FILE
% Choose proper Table_coeff based on n value
if 0<=n<2
Table_coeff = Table_coeff0;
elseif 2<=n<4
Table_coeff = Table_coeff1;
elseif 4<=n<8
Table_coeff = Table_coeff2;
elseif 8<=n
Table_coeff = Table_coeff3;
end
i = 1;
coeff_token = '';
% Find total coefficients and trailing ones
while (i<=length(bits))
coeff_token = [coeff_token bits(i)];
x = strcmp(Table_coeff,coeff_token);
[r,c]=find(x==1);
i = i + 1;
if (r>0)&(c>0)
break;
end
end
% Find total coefficients and trailing ones
i_total = r - 1;
i_trailing = c - 1;
% if no coefficients return 4x4 empty blocks of data
if i_total==0
data = zeros(4,4);
return;
end
k = 1;
m = i_trailing;
while m>0
if bits(i)=='0'
level(k)=1;
elseif bits(i)=='1'
level(k)=-1;
end
k = k + 1;
m = m - 1;
i = i + 1;
end
%% Decode the non-zero coefficient/level values
if (i_total>10)&(i_trailing<3)
i_sufx_len = 1;
else
i_sufx_len = 0;
end
while k<=i_total
% Decode level prefix
[level_prfx,i]= dec_prfx(bits,i);
% Decode level suffix
level_sufx_size = 0;
if (i_sufx_len>0)||(level_prfx>=14)
if (level_prfx==14)&(i_sufx_len==0)
level_sufx_size = 4;
elseif level_prfx>=15
level_sufx_size = level_prfx - 3;
else
level_sufx_size = i_sufx_len;
end
end
if level_sufx_size==0
level_sufx = 0;
else
sufx = bits(i : i + level_sufx_size -1);
level_sufx = bin2dec(sufx);
i = i + level_sufx_size;
end
i_level_code = bitshift(min(15,level_prfx),i_sufx_len) + level_sufx;
if (level_prfx>=15)&(i_sufx_len==0)
i_level_code = i_level_code + 15;
end
if level_prfx>=16
i_level_code = i_level_code + (bitshift(1,level_prfx - 3) - 4096);
end
if (k == i_trailing + 1)&(i_trailing<3)
i_level_code = i_level_code + 2;
end
if rem(i_level_code,2)==0 % i_level_code is even
level(k) = bitshift(i_level_code + 2,-1);
else % odd number
level(k) = bitshift(-i_level_code - 1, -1);
end
if i_sufx_len==0
i_sufx_len = 1;
end
if ((abs(level(k)))>bitshift(3,i_sufx_len - 1))&(i_sufx_len<6)
i_sufx_len = i_sufx_len + 1;
end
k = k + 1;
end
%% Decode total zeros
s='';
i_total_zero = 0;
if i_total==16
i_zero_left = 0;
else
while (i<=length(bits))
s = [s bits(i)];
x = strcmp(Table_zeros(i_total,:),s);
r = find(x==1);
i = i + 1;
if r>0
i_total_zero = r-1;
break;
end
end
end
%% Decode run information
i_zero_left = i_total_zero;
j=1;
ss = '';
run = zeros(1,length(level));
while i_zero_left>0
while (j<i_total)&(i_zero_left>0)
ss = [ss bits(i)];
i_zl = min(i_zero_left,7);
x = strcmp(Table_run(:,i_zl),ss);
r = find(x==1);
i = i + 1;
if r>0
run(j)=r-1;
i_zero_left = i_zero_left - run(j);
j = j + 1;
ss = '';
end
end
if i_zero_left>0
run(j)=i_zero_left;
i_zero_left = 0;
end
end
%% Combine level and run information
k = i_total + i_total_zero;
l = zeros(1,16);
while k>0
for j=1:length(level)
l(k)=level(j);
k = k - 1;
k = k - run(j);
end
end
%% Reorder the data into 4x4 block
scan = [1,1;1,2;2,1;3,1;2,2;1,3;1,4;2,3;3,2;4,1;4,2;3,3;2,4;3,4;4,3;4,4];
for k=16:-1:1
m=scan(k,1);
n=scan(k,2);
data(m,n)=l(k); % l contains the reordered data
end
visit us at www.assignmentpedia.com or email us at info@assignmentpedia.com or call us at +1 520 8371215

More Related Content

Similar to Video Codec

0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
manhduc1811
 
Lecture # 1 introduction revision - 1
Lecture # 1   introduction  revision - 1Lecture # 1   introduction  revision - 1
Lecture # 1 introduction revision - 1
SajeelSahil
 
Lecture # 1 - Introduction Revision - 1 OOPS.pptx
Lecture # 1 - Introduction  Revision - 1 OOPS.pptxLecture # 1 - Introduction  Revision - 1 OOPS.pptx
Lecture # 1 - Introduction Revision - 1 OOPS.pptx
SanaullahAttariQadri
 
stackconf 2022: Are all programming languages in english?
stackconf 2022: Are all programming languages in english?stackconf 2022: Are all programming languages in english?
stackconf 2022: Are all programming languages in english?
NETWAYS
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
GrejoJoby1
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game
Pritam Samanta
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
Akira Maruoka
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
Abdul Haseeb
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
IIUM
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
eugeniadean34240
 
Presentation slides: "How to get 100% code coverage"
Presentation slides: "How to get 100% code coverage" Presentation slides: "How to get 100% code coverage"
Presentation slides: "How to get 100% code coverage"
Rapita Systems Ltd
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
PVS-Studio
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
Andrey Karpov
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
UVSofts Technologies
 

Similar to Video Codec (20)

5059734.ppt
5059734.ppt5059734.ppt
5059734.ppt
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Lecture # 1 introduction revision - 1
Lecture # 1   introduction  revision - 1Lecture # 1   introduction  revision - 1
Lecture # 1 introduction revision - 1
 
Lecture # 1 - Introduction Revision - 1 OOPS.pptx
Lecture # 1 - Introduction  Revision - 1 OOPS.pptxLecture # 1 - Introduction  Revision - 1 OOPS.pptx
Lecture # 1 - Introduction Revision - 1 OOPS.pptx
 
stackconf 2022: Are all programming languages in english?
stackconf 2022: Are all programming languages in english?stackconf 2022: Are all programming languages in english?
stackconf 2022: Are all programming languages in english?
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
 
Presentation slides: "How to get 100% code coverage"
Presentation slides: "How to get 100% code coverage" Presentation slides: "How to get 100% code coverage"
Presentation slides: "How to get 100% code coverage"
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
 

More from Assignmentpedia

Transmitter side components
Transmitter side componentsTransmitter side components
Transmitter side componentsAssignmentpedia
 
Single object range detection
Single object range detectionSingle object range detection
Single object range detectionAssignmentpedia
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar trackingAssignmentpedia
 
Radar cross section project
Radar cross section projectRadar cross section project
Radar cross section projectAssignmentpedia
 
Radar application project help
Radar application project helpRadar application project help
Radar application project helpAssignmentpedia
 
Parallel computing homework help
Parallel computing homework helpParallel computing homework help
Parallel computing homework helpAssignmentpedia
 
Network costing analysis
Network costing analysisNetwork costing analysis
Network costing analysisAssignmentpedia
 
Matlab simulation project
Matlab simulation projectMatlab simulation project
Matlab simulation projectAssignmentpedia
 
Matlab programming project
Matlab programming projectMatlab programming project
Matlab programming projectAssignmentpedia
 
Image processing project using matlab
Image processing project using matlabImage processing project using matlab
Image processing project using matlabAssignmentpedia
 
Help with root locus homework1
Help with root locus homework1Help with root locus homework1
Help with root locus homework1Assignmentpedia
 
Computer Networks Homework Help
Computer Networks Homework HelpComputer Networks Homework Help
Computer Networks Homework Help
Assignmentpedia
 
Theory of computation homework help
Theory of computation homework helpTheory of computation homework help
Theory of computation homework helpAssignmentpedia
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication ProjectAssignmentpedia
 

More from Assignmentpedia (20)

Transmitter side components
Transmitter side componentsTransmitter side components
Transmitter side components
 
Single object range detection
Single object range detectionSingle object range detection
Single object range detection
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar tracking
 
Resolution project
Resolution projectResolution project
Resolution project
 
Radar cross section project
Radar cross section projectRadar cross section project
Radar cross section project
 
Radar application project help
Radar application project helpRadar application project help
Radar application project help
 
Parallel computing homework help
Parallel computing homework helpParallel computing homework help
Parallel computing homework help
 
Network costing analysis
Network costing analysisNetwork costing analysis
Network costing analysis
 
Matlab simulation project
Matlab simulation projectMatlab simulation project
Matlab simulation project
 
Matlab programming project
Matlab programming projectMatlab programming project
Matlab programming project
 
Links design
Links designLinks design
Links design
 
Image processing project using matlab
Image processing project using matlabImage processing project using matlab
Image processing project using matlab
 
Help with root locus homework1
Help with root locus homework1Help with root locus homework1
Help with root locus homework1
 
Transmitter subsystem
Transmitter subsystemTransmitter subsystem
Transmitter subsystem
 
Computer Networks Homework Help
Computer Networks Homework HelpComputer Networks Homework Help
Computer Networks Homework Help
 
Theory of computation homework help
Theory of computation homework helpTheory of computation homework help
Theory of computation homework help
 
Radar Spectral Analysis
Radar Spectral AnalysisRadar Spectral Analysis
Radar Spectral Analysis
 
Pi Controller
Pi ControllerPi Controller
Pi Controller
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication Project
 
Fpga Design Project
Fpga Design ProjectFpga Design Project
Fpga Design Project
 

Recently uploaded

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

Video Codec

  • 1. VIDEO CODEC USING MATLAB Our online Tutors are available 24*7 to provide Help with Video Codec Homework/Assignment or a long term Graduate/Undergraduate Video Codec Project. Our Tutors being experienced and proficient in Video Codec ensure to provide high quality Video Codec Homework Help. Upload your Video Codec Assignment at ‘Submit Your Assignment’ button or email it to info@assignmentpedia.com. You can use our ‘Live Chat’ option to schedule an Online Tutoring session with our Video Codec Tutors. H.264 BASELINE CODEC V2 This sample assignment shows slightly updated version 2 of H.264 baseline codec. dec_cavlc(bits,nL,nU) function [data,i] = dec_cavlc(bits,nL,nU) %% CAVLC Decoder % By A. A. Muhit % It takes bitstream and decodes 4x4 block of data % Load the table containing all the tables % load table.mat; global Table_coeff0 Table_coeff1 Table_coeff2 Table_coeff3 global Table_run Table_zeros % test data % bits = '00000000001000101000000011001011111001011101010000000010000111111111111111001110'; % nL = 0; % nU = 0; % find n parameter (context adaptive) if (nL>0)&(nU>0) n = (nL + nU)/2; elseif (nL>0)|(nU>0) n = nL + nU; else n = 0; end % Coeff_token mapping % Rows are the total coefficient(0-16) and columns are the trailing ones(0-3) % TABLE_COEFF0,1,2,3 ARE STORED IN TABLE.MAT OR CAVLC_TABLES.M FILE % Choose proper Table_coeff based on n value if 0<=n<2 Table_coeff = Table_coeff0; elseif 2<=n<4
  • 2. Table_coeff = Table_coeff1; elseif 4<=n<8 Table_coeff = Table_coeff2; elseif 8<=n Table_coeff = Table_coeff3; end i = 1; coeff_token = ''; % Find total coefficients and trailing ones while (i<=length(bits)) coeff_token = [coeff_token bits(i)]; x = strcmp(Table_coeff,coeff_token); [r,c]=find(x==1); i = i + 1; if (r>0)&(c>0) break; end end % Find total coefficients and trailing ones i_total = r - 1; i_trailing = c - 1; % if no coefficients return 4x4 empty blocks of data if i_total==0 data = zeros(4,4); return; end k = 1; m = i_trailing; while m>0 if bits(i)=='0' level(k)=1; elseif bits(i)=='1' level(k)=-1; end k = k + 1; m = m - 1; i = i + 1; end %% Decode the non-zero coefficient/level values if (i_total>10)&(i_trailing<3) i_sufx_len = 1;
  • 3. else i_sufx_len = 0; end while k<=i_total % Decode level prefix [level_prfx,i]= dec_prfx(bits,i); % Decode level suffix level_sufx_size = 0; if (i_sufx_len>0)||(level_prfx>=14) if (level_prfx==14)&(i_sufx_len==0) level_sufx_size = 4; elseif level_prfx>=15 level_sufx_size = level_prfx - 3; else level_sufx_size = i_sufx_len; end end if level_sufx_size==0 level_sufx = 0; else sufx = bits(i : i + level_sufx_size -1); level_sufx = bin2dec(sufx); i = i + level_sufx_size; end i_level_code = bitshift(min(15,level_prfx),i_sufx_len) + level_sufx; if (level_prfx>=15)&(i_sufx_len==0) i_level_code = i_level_code + 15; end if level_prfx>=16 i_level_code = i_level_code + (bitshift(1,level_prfx - 3) - 4096); end if (k == i_trailing + 1)&(i_trailing<3) i_level_code = i_level_code + 2; end if rem(i_level_code,2)==0 % i_level_code is even level(k) = bitshift(i_level_code + 2,-1); else % odd number level(k) = bitshift(-i_level_code - 1, -1); end if i_sufx_len==0
  • 4. i_sufx_len = 1; end if ((abs(level(k)))>bitshift(3,i_sufx_len - 1))&(i_sufx_len<6) i_sufx_len = i_sufx_len + 1; end k = k + 1; end %% Decode total zeros s=''; i_total_zero = 0; if i_total==16 i_zero_left = 0; else while (i<=length(bits)) s = [s bits(i)]; x = strcmp(Table_zeros(i_total,:),s); r = find(x==1); i = i + 1; if r>0 i_total_zero = r-1; break; end end end %% Decode run information i_zero_left = i_total_zero; j=1; ss = ''; run = zeros(1,length(level)); while i_zero_left>0 while (j<i_total)&(i_zero_left>0) ss = [ss bits(i)]; i_zl = min(i_zero_left,7); x = strcmp(Table_run(:,i_zl),ss); r = find(x==1); i = i + 1; if r>0 run(j)=r-1; i_zero_left = i_zero_left - run(j); j = j + 1;
  • 5. ss = ''; end end if i_zero_left>0 run(j)=i_zero_left; i_zero_left = 0; end end %% Combine level and run information k = i_total + i_total_zero; l = zeros(1,16); while k>0 for j=1:length(level) l(k)=level(j); k = k - 1; k = k - run(j); end end %% Reorder the data into 4x4 block scan = [1,1;1,2;2,1;3,1;2,2;1,3;1,4;2,3;3,2;4,1;4,2;3,3;2,4;3,4;4,3;4,4]; for k=16:-1:1 m=scan(k,1); n=scan(k,2); data(m,n)=l(k); % l contains the reordered data end visit us at www.assignmentpedia.com or email us at info@assignmentpedia.com or call us at +1 520 8371215