Kindly help me out with viterbi algorithm coding....

Hi everybody,
V r doing a project on Spread Spectrum image steganography. One of our module is Low Rate ECC.We plan to do it using convolutional codes using viterbi algorithm.we have a problem in implementing it.Please help me out with the coding .

U would also be requiring Diagram.java
import java.awt.Color;
import java.awt.Graphics;
class Diagram
Diagram()
competitors = new int[20][27];
Letters = "abcdefghijklmnopqrstuvwxyz";
status = "";
x = 10;
y = 70;
no_letters = 0;
word_viable = true;
int[] Get_survivors(String s, int i)
int ai[] = new int[27];
float af[][] = Read_prob.reading_bigrams();
float af1[][] = Read_prob.reading_conf_matrix(i);
float af2[][] = new float[27][27];
float af3[][] = new float[27][27];
int ai1[][] = new int[27][27];
float af4[] = new float[27];
for(int l = 0; l < 27; l++)
af3[0][l] = 0.0F;
af4[l] = 100000F;
ai[l] = 0;
int k = s.length();
int j = s.charAt(0) - 96;
if(j < 0)
j += 32;
for(int i1 = 1; i1 < 27; i1++)
af3[0][i1] = -(af[27][i1] + af1[j][i1]);
float f = 100000F;
for(int j1 = 1; j1 < k; j1++)
j = s.charAt(j1) - 96;
if(j < 0)
j += 32;
for(int k1 = 1; k1 < 27; k1++)
for(int i2 = 1; i2 < 27; i2++)
af2[k1][i2] = af3[j1 - 1][i2] - (af[i2][k1] + af1[j][k1]);
if(af2[k1][i2] < af4[k1])
af4[k1] = af2[k1][i2];
ai1[j1 - 1][k1] = i2;
for(int j2 = 1; j2 < 27; j2++)
af3[j1][j2] = af4[j2];
af4[j2] = 100000F;
for(int l1 = 1; l1 < 27; l1++)
af2[k][l1] = af3[k - 1][l1] - af[l1][27];
if(af2[k][l1] < f)
f = af2[k][l1];
ai[k - 1] = l1;
j = ai[k - 1];
for(int k2 = k - 2; k2 >= 0; k2--)
ai[k2] = ai1[k2][j];
j = ai[k2];
Sort_q(af3, k);
return ai;
void Sort_q(float af[][], int i)
boolean flag = false;
int j = 0;
float f = 100000F;
for(int k = 0; k < i; k++)
for(int l = 0; l < 10; l++)
for(int i1 = 1; i1 < 27; i1++)
if(af[k][i1] < f)
f = af[k][i1];
j = i1;
competitors[k][l] = j;
af[k][j] = 100000F;
f = 100000F;
void Table(Graphics g, int i, String s)
int ai[] = Get_survivors(s, i);
int ai1[] = new int[20];
int ai2[] = new int[20];
no_letters = s.length();
x = 500 / no_letters - no_letters;
for(int j1 = 0; j1 < no_letters; j1++)
x += 35;
y = 80;
int l = x;
int i1 = y;
boolean flag = false;
g.setColor(Color.red);
int j = s.charAt(j1) - 97;
if(j < 0)
j += 32;
g.drawChars(Survivor, j, 1, x + 5, y + 11);
g.setColor(Color.blue);
g.drawRect(x, y, 16, 14);
y += 17;
for(int k1 = 0; k1 < 10; k1++)
int k = competitors[j1][k1];
if(word_viable)
g.setColor(Color.green);
g.drawRect(x, y, 16, 14);
g.setColor(Color.red);
g.drawChars(Survivor, k - 1, 1, x + 5, y + 11);
if(k == ai[j1])
flag = true;
if(k == j + 1)
ai1[j1] = l + 17;
ai2[j1] = i1 + 7;
} else
g.setColor(Color.blue);
g.drawRect(x, y, 16, 14);
g.setColor(Color.green);
g.drawRect(l, i1, 16, 14);
ai1[j1] = x + 17;
ai2[j1] = y + 7;
} else
if(!flag)
ai1[j1] = l + 17;
ai2[j1] = i1 + 7;
y += 17;
for(int l1 = 0; l1 < no_letters - 1; l1++)
g.setColor(Color.blue);
g.drawLine(ai1[l1], ai2[l1], ai1[l1 + 1] - 18, ai2[l1 + 1]);
g.drawChars(Survivor, ai[l1] - 1, 1, ai1[l1] - 12, y + 17);
g.drawChars(Survivor, ai[no_letters - 1] - 1, 1, ai1[no_letters - 1] - 12, y + 17);
void Trellis(Graphics g, int i, String s)
int ai[] = Get_survivors(s, i);
int ai1[] = new int[20];
int ai2[] = new int[20];
no_letters = s.length();
x = 500 / no_letters;
for(int k = 0; k < no_letters; k++)
x += 35;
y = 60;
for(int l = 0; l < 26; l++)
g.setColor(Color.green);
if(word_viable)
int j = Survivor[l] - 96;
if(ai[k] == j)
g.setColor(Color.blue);
ai1[k] = x + 17;
ai2[k] = y + 7;
g.drawRect(x, y, 16, 14);
g.setColor(Color.red);
g.drawChars(Survivor, l, 1, x + 5, y + 11);
y += 17;
for(int i1 = 0; i1 < no_letters - 1; i1++)
g.setColor(Color.blue);
g.drawLine(ai1[i1], ai2[i1], ai1[i1 + 1] - 18, ai2[i1 + 1]);
g.drawChars(Survivor, ai[i1] - 1, 1, ai1[i1] - 12, y + 17);
g.drawChars(Survivor, ai[no_letters - 1] - 1, 1, ai1[no_letters - 1] - 12, y + 17);
void delete()
for(int i = 0; i < no_letters; i++);
public String status;
public int competitors[][];
public String Letters;
public char Survivor[] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z'
public int x;
public int y;
public boolean word_viable;
public int no_letters;
private Read_prob r_prob;
}

Similar Messages

  • Kindly help me out with this prepared statement

    Hi All,
    I am having some problem with this code.The databaseUsername and databasePassword seem to be printing only null, what could be the problem.
    AFIAK, it is not going into the while loop itself.
    Help would be greatly appreciated.
    TIA
    AS
    try {
                  String sql = "SELECT username, password FROM admintable WHERE username = ? AND password = ?";
                PreparedStatement stmt = null;
                ResultSet rs = null;
                stmt=con.prepareStatement(sql);
                stmt.setString(1, username);
                stmt.setString(2, password);
                rs = stmt.executeQuery();
                String databaseUsername = null;
                String databasePassword = null;
                while (rs.next()){
                    databaseUsername=rs.getString("username");
                    databasePassword=rs.getString("password");
                     System.out.println("Values are Username " + databaseUsername);
                     System.out.println("Values are Password "+ databasePassword);
                 rs.close();
                 stmt.close();

    Hi Again,
    I would like to tell that there is only one entry in the database table.
    String sql = "SELECT username, password FROM professorforminfo.admintable WHERE username = ? AND password = ?";
                PreparedStatement stmt = null;
                ResultSet rs = null;
                stmt=con.prepareStatement(sql);
                stmt.setString(1, username);
                stmt.setString(2, password);
                rs = stmt.executeQuery();
                String databaseUsername = null;
                String databasePassword = null;
                while (rs.next()){
                    databaseUsername=rs.getString("username");
                    databasePassword=rs.getString("password");
                     System.out.println("Username value " + databaseUsername);
                     System.out.println("Password value "+ databasePassword);
                  }catch(SQLException sqlEx){
                       System.err.println("Unable to connect to DB");
                       sqlEx.printStackTrace();
                 rs.close();
                 stmt.close();Why do you think that the databaseUsername and databasePassword has null values in them.
    Kindly help me out.
    Thanking you
    AS

  • Please kindly help me out.... i just update my iphone to the latest os but i was unable to set my phone up now

    Please kindly help me out.... i just update my iphone to the latest os but i was unable to set my phone up now

    Did you buy your phone unlocked from Apple or did you have the original carrier unlock it? Or did you have some third party unlock it for you? If the latter, and you are trying to set the phone up with a different carrier than the original, you're going to have problems as the update most likely reversed the unauthorized unlock.

  • I'm not able to create my apple id without my credit card number in my iphone 5c.there is no way to skip this step.there is no option like "NONE" to skip that step.kindly help me out.im unable to download even free apps

    i'm not able to create my apple id without my credit card number in my iphone 5c.there is no way to skip this step.there is no option like "NONE" to skip that step.kindly help me out.im unable to download even free apps

    See
    Why can’t I select None when I edit my Apple ID payment information?
    and
    Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    Step 3 is important, no matter whether you do this on a Mac or an iPad / iPhone:
    Important: Before proceeding to the next step, you must download and install a free application. ...
    Important: Before proceeding to the next step, you must download and install the free application by tapping Free followed by tapping Install App. …
    First you must download a free app from the App Store. When you are asked to sign in with your Apple ID, select "Create new account". Accept the terms and conditions checkbox, then click Continue. After you enter all the requested personal data, click Continue.
    When you are asked to select a payment method, select "None". 
    That's all there is to it.

  • My iPhone 6 ear speaker is not working properly I couldn't able to hear any thing from ear speaker to lissen I had to put on loud speaker or to use handsfree please help me out with this problem if some body have answer?

    My iPhone 6 ear speaker is not working properly I couldn't able to hear any thing from ear speaker to listen I had to put on loud speaker or to use hands free please help me out with this problem if some body have answer?

    Hi Venkata from NZ,
    If you are having an issue with the speaker on your iPhone, I would suggest that you troubleshoot using the steps in this article - 
    If you hear no sound or distorted sound from your iPhone, iPad, or iPod touch speaker - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • Hi Friends... I'm trying to delete a back-up file on mu TC but I get the message "The operation could not be completed because the item "bands" is in use. I'd like to start the Back from scratch, could help me out with deleting the current file?

    Hi Friends...
    I’m trying to delete a back-up file on mu TC but I get the message “The operation could not be completed because the item “bands” is in use. I’d like to start the Back from scratch, could help me out with deleting the current file?

    Sorry, I am very confused. I asked the following question....
    Is this the only backup file on your Mac, or do you have other backup files and data on the Time Capsule disk?
    The answer that you gave was....
    This is the only one
    Now you are saying that....
    But I have lots of other files on Time Capsule! The back up file is only one of them.
    Can you clarify, please?

  • I have several issues that I hope you can help me out with. I am a professional photographer with a Mac with OS X 10.9.4: - I can only make ONE contact sheet in CS6 (from AUTOMATE) from pictures indicated in Bridge. If I want to make another contact sheet

    I have several issues that I hope you can help me out with. I am a professional photographer with a Mac with OS X 10.9.4:
    - I can only make ONE contact sheet in CS6 (from AUTOMATE) from pictures indicated in Bridge. If I want to make another contact sheet I need to shut down and restart CS6.
    - Camera RAW: if I change any setting in Camera RAW (except exposure), having first optimized the exposure, the exposure will automatically return to zero. Sometimes when I've set exposure and cropped the picture in Camera RAW Plug-In, the effects are lost just by opening the picture in CS6.
    - Sometimes if I crop a picture in Camera RAW, it may be impossible to open it again from Bridge!
    - I cannot do lens corrections in Camera RAW, at all. The Camera RAW comment is that "it cannot load the correct lens type". Why?

    Are you writing that when you select  a large number of images in the bridge  like a hundred thumbnails  when you then use Bridge menu Tools>Photoshop>Contact Sheet II that Photoshop only produces a single contact sheet for the first few thumbnails and fails to produce additional contact sheets for the other selected thumbnails? Photoshop contact sheet II script should create as many contact sheet as needed  for the numbers of thumbnails selected.  Perhaps the script is hung or you have exhausted  your machine resources.
    ACR Crop tool does not crop the RAW file it records crop settings to be used during the conversion process.    Camera RAW DATA is not altered.  The only changes made to RAW Files is ACR Metadata may be added.  Anything you do in ACR can be un-done in ACR.    If you can not open a RAW File in ACR the Files is either corrupt or from a new camera ACR does not support yet.  ACR should not corrupt RAW files.
    If you do not have a lens profile for ACR I think you should still be able to do lens correction manually in ACR.
    Some of what you write I don't follow could you post some screen captures of your problems often a picture helps.

  • Firefox is not able load any websites but others programs can. i tried everything given in the support forum but nothing worked out. so can you please help me out with it?

    firefox is not able to load any websites... i tried everything given in the support forum under the topic firefox is not able to load any websites but other programs can.. but still i am facing the same problem. so please help me out with this issue!!

    firefox is not able to load any websites... i tried everything given in the support forum under the topic firefox is not able to load any websites but other programs can.. but still i am facing the same problem. so please help me out with this issue!!

  • Please help me out with some fundamentals in BW

    Hello,
    Please guide me regarding the below mentioned questions.
    1. what is the key date in query designer.
    2. when do we perform attribute change run
        like once the master data is loaded then we perform attribute change run and load the transactional data ?
    3.what is the disadvantage of using aggregates.
    4. what is full repair options?
    please help me out with these questions

    HI,
    Repair full request :
    If you indicate a request in full update mode as a repair request, then it is able to be updated in all data targets. This is also true if they already contain data from initial runs or deltas for this DataSource / source system combination, and they have overlapping selections.
    Consequently, a repair request can be updated at any time without checking each ODS object. The system supports loading in an ODS object by using the repair request without having to check the data for overlapping or request sequencing. This is because you can also delete selectively without checking an ODS object.
    Posting such requests can lead to duplicate data records in the data target.
    Hierarchy/attribute change run after loading master data;
    When hierarchies or attributes of characteristics change, the aggregate affected by the change can be adjusted manually or calculated automatically in process chains.
    Aggregates:
    Aggregates are materialized, pre-aggregated views on InfoCube fact table data. They are independent structures where summary data is stored within separate transparent InfoCubes. The purpose of aggregates is purely to accelerate the response time of queries by reducing the amount of data that must be read in the database for a given query navigation step. In the best case, the records presented in the report will exactly match the records that were read from the database.
    Aggregates can only be defined on basic InfoCubes for dimension characteristics, navigational attributes (time-dependent and time-independent) and on hierarchy levels (for time-dependent and time-independent hierarchy structures). Aggregates may not be created on ODS objects, MultiProviders or Remote Cubes.
    Queries may be automatically split up into several subqueries, e.g for individual restricted key figures (restricted key figures sales 2001 and sales 2002). Each subquery can use one aggregate; hence, one query can involve several aggregates.
    If an aggregate has less than 15 components, BW 3.x puts each component automatically into a separate dimension that will be marked as “line item” (except package and unit dimension); these aggregates are called flat aggregates. Hence, dimension tables are omitted and SID tables referenced directly.  Flat aggregates can be rolled up on the DB server (i.e., without loading data into the application server). This accelerates the roll up (hence the upload) process.
    Disadvantage : The more aggregates exist, the more time-consuming is the roll-up process and thus the data loading process; the change run is also affected.
    Hope this info Helps.
    Thanks,Ramoji.

  • Please help me out with the function code of print option in module pool

    please help me out with the function code of print option in module pool, along with CASE condition.
    regards,
    asif

    Hi
    you can use the Function module
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        destination            = 'LP01'                       "'Printer name
        list_name              = 'TEST'
        list_text              = 'SUBMIT ... TO SAP-SPOOL'
        immediately            = ' '
        line_size              = '2000'
        no_dialog              = 'X'             "pass space to Pop screen for Print option
      IMPORTING
        out_parameters         = wa_pri_params
        valid                  = w_valid.
    "next call below things
      NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params.
         "and try to Print the values inside the new-page
      NEW-PAGE PRINT OFF.
    Prabhudas

  • I received an email telling me that my icloud storage is almost full.  I need to upgrade to the next level.  Can someone help me out with this?

    I received telling me that my icloud storage is almost full.  I need to upgrade my storage.  Can someone help me out with this.  I understand that the 20 GB is only .99 per month.  Just hoping this would be enough for me.  I back up 2 ipads and my iphone on the same computer.  Any help you can give me would be appreciated.  Thank you.

    Okay.
    I responded as I did because you wrote, "I have 2 ipads and my iphone that I back up on one computer"
    No worries here.
    But hopefully you get/got it sorted.
    Any issues, post back.

  • Hello,everyone.i purchased an iphone 5S from a retailer in my country after coming back to my home i restore this iphone it shows an activation id but i dont know what i have to do now?my apple id does not work in this situation.kindly help me out

    Hello,everyone.i purchased an iphone 5S from a retailer in my country after coming back to my home i restore this iphone it shows an activation id but i dont know what i have to do now?my apple id does not work in this situation.kindly help me out because it cost me to high and if this is not activated i have to bear a huge loss.i am a loyal customer of apple from a past 5 years.thank you for your cooperation

    Yes, this is activation lock. Return the phone for a refund, as it is useless without the activation information of the previous owner.

  • I can't update my flash player and i might have a virus help me out with any advice on getting my mac on track ?

    i can't update my flash player and i might have a virus help me out with any advice on getting my mac on track ?

    You may have installed one or more of the common types of ad-injection malware. Follow the instructions on this Apple Support page to remove it. It's been reported that some variants of the "VSearch" malware block access to the page. If that happens, start in safe mode by holding down the shift key at the startup chime, then try again.
    Back up all data before making any changes.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, ask for further instructions.
    Make sure you don't repeat the mistake that led you to install the malware. It may have come from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    Malware is also found on websites that traffic in pirated content such as video. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.

  • I just got the iPhone 5.  It's completely synced and working.  All my contacts are loaded.  However, caller ID is not working when I receive a call or a text.  Can anyone help me out with this?

    I just got the iPhone 5. It's completely synced and working.  All my contacts are loaded.  However, caller ID is not working when I receive a call or a text.  Can anyone help me out with this?

    Well, assuming all of the above, Notifications, etc., it just might be time for a visit to the Apple tore genius center for a session with the techs.  See if it is a fault in the hardware or just an iOS reinstall is the answer.
    One more thing you could try, backup so you have a record of content, then restore to factory conditions be an Erase All Contents and Settings.  Then restore from the backup you just made.  That has helped some with WiFi problems, may be it would work with your problems.
    But with that behavior of another app with problems, the geniuses looks like a less stressful thing to do.

  • How to access the activities created by an enduser especially when the enduser has left the organization?Please help me out with the possible solution

    How to access the activities created by an end user especially when the end user has left the organization?Please help me out with the possible solution

    Hi Ramesh,
    In the web UI we have business role IC_manger where you can search the activities based on employee responsible and you can use business transaction assignment functionality to assign those activities to any  other end user or team.
    Else you can also use Agent inbox functionality if you have configure the agent inbox for those activity.
    Hope this helps solving your query

Maybe you are looking for

  • Selected value in dropdown list box

    hi forums,   how to capture the selected value in drop down list box and how it will link with the table. layout:     <htmlb:dropdownListBox  id = "d1%>"                             nameOfKeyColumn = "vbeln"                           nameOfValueColum

  • My tracpad is depressed

    My track pad seems to be getting hung up. When I push down on the track  pad, it sticks. So if I am trying to highlight an article, it will highlight the article as It should, but then it will stay depressed and if I lightly drag my finger over it, i

  • I am trying to update the operating systems on I pod touch 3rd generation.

    I am trying to update my operating systems on I pod touch, 3rd generation. The instructions say: Settings General Updates I don't have an updates options on my i pod touch?

  • Dynamically change with of regions

    Hi, i have to display 2 regions side by side on the screen. This works very fine when I post style="width:300px;float:left;clear:none" But for users with a grate or smale display I want to use an item (or page variable) to set the display width lager

  • Runtime error R6025 - pure virtual function call

    I'm running the latest version 10.6.3.25 of iTunes on Windows Vista. When I tried to search in app store using the search pane on the righthand top, it crushes and a box appears saying "Runtime error! R6025 - pure virtual function call". I cannot sea